문제

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?

도움이 되었습니까?

해결책

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top