# Using addGameParameter, I'm missunderstanding the docs

**URL:** <https://qa.fmod.com/t/using-addgameparameter-im-missunderstanding-the-docs/21348>\
**Category:** FMOD Studio\
**Created:** [March 11, 2024, 9:51am UTC](https://qa.fmod.com/t/using-addgameparameter-im-missunderstanding-the-docs/21348 "2024-03-11T09:51:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![spakment](https://avatars.discourse-cdn.com/v4/letter/s/71c47a/32.png) [@spakment](https://qa.fmod.com/u/spakment)\
**Post date:** [March 11, 2024, 9:51am UTC](https://qa.fmod.com/t/using-addgameparameter-im-missunderstanding-the-docs/21348/1 "2024-03-11T09:51:33Z")

</div>

I’m trying to set up an event with a parameter, and am using the details from the docs at  
[https://www.fmod.com/docs/2.02/studio/scripting-api-reference-project.html#parameterdefinition](https://www.fmod.com/docs/2.02/studio/scripting-api-reference-project.html#parameterdefinition)

setting the parameter definition like this:

```auto
var trackname = "Track1";    
var datetime = new Date().toJSON().slice(0,19).toString().replace(":", "");
var newEvent = studio.project.create( "Event" );
newEvent.name = trackname + " " + datetime;
newEvent.folder = studio.project.workspace.masterEventFolder;
studio.window.navigateTo(newEvent);
var _min = 0;
var _max = 6; //this is a calculated value in my actual script

console.log("Setting " + trackname + "Vol" + " min:" + _min + ", max: " + _max);

//add in a parameter to drive volume
var volParam = newEvent.addGameParameter({ 
            name: trackname + "Vol", 
            type: studio.project.parameterType.UserDiscrete, 
            min: _min, 
            max: _max 
        });

```

this ends up with a parameter with it’s min and max both set to 0. I’m unable to set the min and max values.  
If I edit the preset child I seem to get the right outcome,

```auto
volParam.preset.minimum = _min;
volParam.preset.maximum = _max;
volParam.preset.initialValue = 1;

```

Which feels like its not the right way to go about this, from how the docs are showing the objects.

thanks for any help

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [March 13, 2024, 4:10am UTC](https://qa.fmod.com/t/using-addgameparameter-im-missunderstanding-the-docs/21348/2 "2024-03-13T04:10:41Z")

</div>

Hi,

Thank you for bringing this to our attention. I have been able to reproduce the issue and will pass it on to our development team to look into it further.

In the meantime, your workaround is a valid option. Once there are updates I will post them here.
