I'm trying to create a GUI that when you click it, it locks on to your mouse.
This is the simple script:
script.Parent.MouseButton1Down:connect(function(x,y)
local startPos = script.Parent.Position
local conn = script.Parent.MouseMoved:connect(function(X,Y)
script.Parent.Position = startPos + UDim2.new(0,X-x,0,Y-y)
end)
end)
For the most part it all works out, but when I test it this happens.
The GUI stops locking on when the mouse goes too fast. I've been stumped on this for a while, any help or suggestions?

1 comment
You could try using a loop to check to see if the mouse has moved, instead of using an event. But it would be harder on the server.