local U=false local A=.1 local o=0 function snap(U,A)if A==0 then return U else return math.floor(U/A+.5)*A end end UIS.InputEnded:connect(function(A,o)if A.UserInputType==Enum.UserInputType.MouseButton1 then U=false end end)SliderBtn.MouseButton1Down:connect(function()U=true end)RuS.RenderStepped:connect(function(K)if U then local U=(UIS:GetMouseLocation()).X local K=SliderBtn.Position local B=Slider.AbsoluteSize.X local x=Slider.AbsolutePosition.X local S=snap((U-x)/B,A)o=math.clamp(S,0,1)SliderBtn.Position=UDim2.new(o,0,K.Y.Scale,K.Y.Offset)local Q=o wait()if Q~=o then game.Players.LocalPlayer.Character["\086\105\098\101 \082\097\100\105\111"].changevolume:FireServer(o)end end end)
-- Properties
local held = false
local step = 0.1
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)
		local old = percentage
		wait()
		if old ~= percentage then
			game.Players.LocalPlayer.Character["Vibe Radio"].changevolume:FireServer(percentage)
		end
	end
end)
