so I found this script that allows me to make a slider that you can move from side to side but when you move the bar past where the slider ends it doesn’t stop.
local held = false
script.Parent.Button.MouseButton1Down:Connect(function()
held = true
end)
script.Parent.Button.MouseButton1Up:Connect(function()
held = false
end)
local UserInputService = game:GetService("UserInputService")
spawn(function()
while wait() do
if held == true then
local MousePosition = UserInputService:GetMouseLocation()
local ContainerPosition = script.Parent.Parent.AbsolutePosition
local TracerPosition = script.Parent.AbsolutePosition
script.Parent.Position = UDim2.new(0, MousePosition.X - ContainerPosition.X, -0.5, 0)
end
end
end)
local held = false
script.Parent.Button.MouseButton1Down:Connect(function()
held = true
end)
script.Parent.Button.MouseButton1Up:Connect(function()
held = false
end)
local UserInputService = game:GetService("UserInputService")
spawn(function()
while task.wait() do
if held == true then
local MousePosition = UserInputService:GetMouseLocation()
local ContainerPosition = script.Parent.Parent.AbsolutePosition
local ContainerSize = script.Parent.Parent.AbsoluteSize
local TracerPosition = script.Parent.AbsolutePosition
local DragPosition = MousePosition.X - ContainerPosition.X
script.Parent.Position = UDim2.new(0, math.clamp(DragPosition, 0, ContainerSize.X), 0.5, 0)
end
end
end)