Slider
Sliders expose numeric settings with optional prefixes, suffixes, and callbacks.
Playground
Slider
25/100
Toggle compact view
Usage
You can create a Slider by calling the AddSlider method on a Groupbox.
Arguments
local Slider = Groupbox:AddSlider("Sensitivity", {
Text = "Sensitivity",
Default = 50,
Min = 0,
Max = 100,
Rounding = 0,
})| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Index/ID of the slider | string | nil |
| 2 | Slider configuration table | table | nil |
Configuration Table
Prop
Type
Methods
You can use the following methods to interact with the slider:
SetValue
Sets the slider value.
Slider:SetValue(number)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | The new value of the slider | number | nil |
SetText
Updates the slider's text.
Slider:SetText(text)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | The new text of the slider | string | nil |
SetMin
Sets the minimum value.
Slider:SetMin(number)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Minimum allowed value | number | nil |
SetMax
Sets the maximum value.
Slider:SetMax(number)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Maximum allowed value | number | nil |
SetDisabled
Enables or disables the slider.
Slider:SetDisabled(boolean)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Whether to disable the slider | boolean | nil |
SetVisible
Shows or hides the slider.
Slider:SetVisible(boolean)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Whether to show the slider | boolean | nil |
SetPrefix
Sets the prefix text.
Slider:SetPrefix(text)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Text displayed before the value | string | nil |
SetSuffix
Sets the suffix text.
Slider:SetSuffix(text)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Text displayed after the value | string | nil |
OnChanged
Adds another callback function.
Slider:OnChanged(function)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Callback executed on value change | function | nil |
Example
local Options = Library.Options
Groupbox:AddSlider("Sensitivity", {
Text = "Sensitivity",
Default = 50,
Min = 0,
Max = 100,
Rounding = 0,
Suffix = "%",
})
Options.Sensitivity:OnChanged(function(value)
print("Slider changed to", value)
end)