Question

So, I was making a plugin for ROBLOX Studio, and got caught on the RbxGui methods. I created a slider inside a frame using

local sGui = Instance.new("ScreenGui", game.CoreGui)
local PaceFrame = Instance.new("Frame", sGui)
PaceFrame.Size = UDim2.new(0, 210, 0, 200)
local PaceSlider = RbxGui.CreateSlider(10,200,UDim2.new(0, 5, 0, 175))
PaceSlider.Parent = PaceFrame

So my question is, how can I detect when the slider value is moved?

Was it helpful?

Solution

RbxGui.CreateSlider returns two values, a frame for the slider as well as an IntValue with the position.

You should be able to use IntValue.Changed to detect changes:

local sGui = Instance.new("ScreenGui", game.CoreGui)
local PaceFrame = Instance.new("Frame", sGui)
PaceFrame.Size = UDim2.new(0, 210, 0, 200)
local PaceSlider, PaceSliderPosition = RbxGui.CreateSlider(10,200,UDim2.new(0, 5, 0, 175))
PaceSlider.Parent = PaceFrame
PaceSliderPosition.Changed:connect(function(position)
    print("Slider position is now " .. position)
end)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top