I want to create a GUI that when i click it, it will follow the player’s mouse and when the player clicks again, it will stop moving. How can i achieve this?
Here’s my code that i already have:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
script.Parent.Mover.MouseButton1Click:Connect(function()
repeat
script.Parent.Position = UDim2.new(0, ((mouse.X)-90), 0, ((mouse.Y)-20))
until script.Parent.Mover.MouseButton1Click
end)
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
script.Parent.Mover.MouseButton1Click:Connect(function()
repeat
script.Parent.Position = UDim2.new(0, ((mouse.X)-90), 0, ((mouse.Y)-20))
until mouse.MouseButton1Down
end)
It’s odd, whenever i try either one of these, it makes the GUI invisible but i know it is there because my cursor goes black. It is also not printing out any errors in the output?