I am trying to make a slider UI but it is not working. Due to the logic of the position property, if I drag the slider, it will go out of the frame. It will also not stop if I stop holding down. Here is my broken code in a LocalScript:
mouse = game.Players.LocalPlayer:GetMouse()
mousedown = false
script.Parent.MouseButton1Down:Connect(function()
mousedown = true
end)
script.Parent.MouseButton1Up:Connect(function()
mousedown = false
end)
mouse.Move:Connect(function()
if mousedown == true then
script.Parent.Position = UDim2.new(0, math.clamp(mouse.X, script.Parent.Parent.StartTeller.AbsolutePosition.X, script.Parent.Parent.EndTeller.AbsolutePosition.X), 0.5, 0)
end
end)
If you want the model file, click here.
Thanks!
