local W=false local w=.01 local g=0 function snap(W,w)if w==0 then return W else return math.floor(W/w+.5)*w end end UIS.InputEnded:connect(function(w,g)if w.UserInputType==Enum.UserInputType.MouseButton1 then W=false end end)SliderBtn.MouseButton1Down:connect(function()W=true end)RuS.RenderStepped:connect(function(l)if W then local W=(UIS:GetMouseLocation()).X local l=SliderBtn.Position local N=Slider.AbsoluteSize.X local y=Slider.AbsolutePosition.X local c=snap((W-y)/N,w)g=math.clamp(c,0,1)SliderBtn.Position=UDim2.new(g,0,l.Y.Scale,l.Y.Offset)end end)

local held = false
local step = 0.010
local percentage = 0

function snap(number, factor)
	if factor == 0 then
		return number
	else
		return math.floor(number/factor+0.5)*factor
	end
end

UIS.InputEnded:connect(function(input, processed)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		held = false
	end
end)

SliderBtn.MouseButton1Down:connect(function()
	held = true
end)


RuS.RenderStepped:connect(function(delta)
	if held then
		local MousePos = UIS:GetMouseLocation().X
		local BtnPos = SliderBtn.Position
		local SliderSize = Slider.AbsoluteSize.X
		local SliderPos = Slider.AbsolutePosition.X
		local pos = snap((MousePos-SliderPos)/SliderSize,step)
		percentage = math.clamp(pos,0,1)
		SliderBtn.Position = UDim2.new(percentage,0,BtnPos.Y.Scale, BtnPos.Y.Offset)
	end
end)
