CreateSlider (Function): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>JulienDethurens
No edit summary
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">"
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<onlyinclude>
<onlyinclude>
{{Function|name = CreateSlider
{{Function|name = CreateSlider
|arguments  = [[number]] '''steps''', [[number]] '''width''', [[UDim2]] '''position'''
|arguments  = [[number]] <var>steps</var>, [[number]] <var>width</var>, [[UDim2]] <var>position</var>
|returns    = [[Frame]] ''sliderGui'', [[IntValue]] ''sliderPosition''
|returns    = [[RBX.lua.Frame (Object)|Frame]] <var>sliderGui</var>, [[RBX.lua.IntValue (Object)|IntValue]] <var>sliderPosition</var>
|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.  
|description =  Returns 2 objects, (<var>sliderGui</var>, <var>sliderPosition</var>). <var>sliderGui</var> is a [[RBX.lua.Frame (Object)|Frame]] that contains the entire slider gui. <var>sliderPosition</var> is an [[RBX.lua.IntValue (Object)|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 <var>steps</var> argument specifies how many different positions the slider can hold along the bar.  <var>width</var> specifies in pixels how wide the bar should be (modifiable afterwards if desired). <var>position</var> argument should be a UDim2 for slider gui positioning.  
}}
}}


Line 9: Line 9:
</onlyinclude>
</onlyinclude>


<table><tr><td><code lua>
<table><tr><td><syntaxhighlight lang="lua">
local RbxGui = assert(LoadLibrary('RbxGui'))
local RbxGui = assert(LoadLibrary('RbxGui'))


Line 19: Line 19:


exampleSliderValue.Value = 5
exampleSliderValue.Value = 5
</code></td><td>[[Image:CreateSlider.jpg|thumb|250px|CreateSlider Example]]</td></tr></table>
</syntaxhighlight></td><td>[[Image:CreateSlider.jpg|thumb|250px|CreateSlider Example]]</td></tr></table>
 
==See Also==
*[[RbxGui (Library)|RbxGui]]
 
[[Category:Functions]]

Latest revision as of 06:10, 27 April 2023

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