I have a gui slider that goes up and down, I DON’T WANT TO USE SCROLLING FRAME DONT SUGGEST IT PLEASE. And im using this simple line, that in theory should work:
repeat
wait()
script.Parent.Position = UDim2.new(0.5,0,0,mouse.Y-script.Parent.AbsolutePosition.Y)
until pulling == false
the anchor point is 0.5,0
and for some reason it glitches out like:
does anyone know what is going on and how to fix it? this is the entire script:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local pulling = false
mouse.Button1Down:Connect(function()
local x = mouse.X
local y = mouse.Y
local minX,maxX = script.Parent.AbsolutePosition.X,script.Parent.AbsolutePosition.X+(script.Parent.AbsoluteSize.X)
local minY,maxY = script.Parent.AbsolutePosition.Y,script.Parent.AbsolutePosition.Y+script.Parent.AbsoluteSize.Y
if x >= minX and x <= maxX and y >= minY and y <= maxY then
pulling = true
repeat
wait()
script.Parent.Position = UDim2.new(0.5,0,0,mouse.Y-script.Parent.AbsolutePosition.Y)
until pulling == false
else
--
end
end)
mouse.Button1Up:Connect(function()
pulling = false
end)
the only issue i have is with the positioning, everything else works perfectly as I intended