CreateSlider (Function)

From Legacy Roblox Wiki
Jump to navigationJump to search
CreateSlider( number steps, number width, UDim2 position )
Returns Frame sliderGui, IntValue sliderPosition
Description: Returns 2 objects, (sliderGui, sliderPosition). sliderGui is a Frame that contains the entire slider gui. sliderPosition is an IntValue whose current value specifies the specific step the slider is currently on (This value can be modified by a script, and the slider with adjust position). The steps argument specifies how many different positions the slider can hold along the bar. width specifies in pixels how wide the bar should be (modifiable afterwards if desired). position argument should be a UDim2 for slider gui positioning.


local RbxGui = assert(LoadLibrary('RbxGui'))

local screenGui = Instance.new('ScreenGui')
screenGui.Parent = game.Players.LocalPlayer.PlayerGui

local exampleSliderGui, exampleSliderValue = RbxGui.CreateSlider(10,200,UDim2.new(0.5, 270, 0.5, 232))
exampleSliderGui.Parent = screenGui 

exampleSliderValue.Value = 5
CreateSlider Example

See Also