I want my gui to attach to the mouse icon when the player holds down on the gui. I want my gui to deattach when the player lifts their mouse button up.
The gui attaches to the mouse icon, but it does not deattach.
I have tried adding debounce (did not work). I’ve also used print(), and the code works, it’s just that the gui does not deattach.
local mouse = game.Players.LocalPlayer:GetMouse() local isattached = false script.Parent.MouseButton1Down:Connect(function() if isattached == false then isattached = true print("nowAttached") game:GetService("RunService").RenderStepped:Connect(function() script.Parent.Position = UDim2.new(0,mouse.X,0,mouse.Y) end) end end) script.Parent.MouseButton1Up:Connect(function() if isattached == true then isattached = false print("Now unattached") script.Parent.Position = UDim2.new(0.5,0,0.5,0) end end)