How would I make a Gui stick to my cursor? (Similar to Pong.)

I am having some issues with how to even start. I am trying to make my mouse stick to a gui like a text label or image label. I would like it to be able to move with the mouse similar to pong.

you just have to get the mouse position then set the position:

local mouse = game.Players.LocalPlayer:GetMouse()
local Frame = framethatmoves

game:GetService("RunService").RenderStepped:Connect(function()
    Frame.Position = Udim2.new(0, Mouse.X, 0, Mouse.Y)
end

The script will update the position of a frame whenever a frame goes by.

5 Likes

Would I put this in a local script in startergui or starterplayerscripts maybe?

It’s for a GUI, so logically, you would put it in StarterGui. You can always (and often should) try things out and see if they work instead of just asking here. If you tried it yourself, it would’ve taken about 8 seconds instead of 8 hours to get a response.

10 Likes