Issue setting the position of a frame to a client's mouse position

Hello! I am currently working on a pet UI for my game but I’m facing an issue positioning a frame to the client’s mouse position.

-- This is my current code
Frame.Position =, Mouse.X, 0, Mouse.Y)

Expected result:

Current result:

I tried following instructions from all the topics below but none of them worked for me.

Any help is appreciated!

1 Like

Try to use scale and not offset.

I’ve also got something to work and it stays in the same position as your mouse

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

	script.Parent.Frame.Position =, 0, mouse.Y/mouse.ViewSizeY, 0)

This is what I get by using your code:

Is the frame a child of some other frame? Because if so the mouse’s 0,0 position is at the top left of the screen, while the frame’s 0,0 position is at the top left of its parent.

If that’s the issue you can fix by subtracting the parent’s AbsolutePosition from the mouse position.