Slider

The slider UI element allows the users to select a value by sliding a thumb control along a track.

To add a slider UI element to your mod, use the utils.addSlider function. This function takes the following parameters:

utils.addSlider(section, key, title, defaultValue, description, minimumValue, maximumValue)
  • section: The section to add the slider to.

  • key: A unique key to identify the slider.

  • title: The title of the slider.

  • defaultValue: The default value of the slider.

  • description: A description of the slider (optional).

  • minimumValue: The minimum value of the slider (optional, defaults to 0).

  • maximumValue: The maximum value of the slider (optional, defaults to 100).

Here's an example of how to use the utils.addSlider function:

local section = utils.addSection(mainView, "Speed Modifier", "description")

utils.addSlider(section, "setspeedkey", "Speed", 50, "Adjust the players speed.", 0, 100)

You can access the current value of a slider using the getValueForKey function:

local sliderValue = getValueForKey("setspeedkey")

Last updated