✓ Accepted answer
It's you're lucky day, this is what I just finished doing! I made it move in intervals, complicating the matter, but it's surprisingly easy(ish) to move a GUI on one axis.
I'd suggest not using the draggable property. I believe it is easier using MouseButton1Down and detecting when and how far the mouse is dragged using the Move event.
local mouse = game.Players.LocalPlayer:GetMouse()
local gui = script.Parent
gui.MouseButton1Down:connect(function()
local dragging = true
mouse.Move:connect(function()
if dragging then
gui.Position = UDim2.new(0, mouse.X, 0, gui.Position.Y.Offset)
end
end)
mouse.Button1Up:connect(function()
dragging = false
end)
gui.MouseButton1Up:connect(function()
dragging = false
end)
end)
Only problem I'm having is that once mouse.Move is called it will always be checking to see if the mouse is moving (hense the dragging variable). So if someone knows how to make Button1Up and MouseButton1Up stop mouse.Move from running, I could make the transition from still to moving smoother. This still works, but if you know how to solve this problem leave a comment!
1 comment
You can try creating a function/loop that checks the position of the button every time the position is changed, and then sets its X/Y position to whatever you would like.