Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a Mouse Follow GUI with scaling?

So I'm trying to make a GUI follow the Player's mouse. Here's a script I've Tried (LocalScript inside the GUI)

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()

while wait() do
    script.Parent.Position = UDim2.new(0,Mouse.X,0,Mouse.Y)
end

The problem is everytime I re-size the screen the GUI keeps moving from the mouse. So I tried doing moving the GUI with Scale instead of the Offset, but the GUI pretty much disappears when I do that. How could I fix this problem?

3 comments

0

the ui dissapears when you do that, because mouse doesnt hav a scale, only an offset, and since scale takes small numbers and offset does big ones, its making it really far away

0

and what do you mean exactly by re-sizing screen? i did that and it still worked

0

Like for example, changing the screen resolution, or even when I hide my explorer and properties tab. It re-sizing my screen and the GUI is not where it was when I had the explorer and properties tabs open.

1 answer

Figured it out, It's because I had the GUI inside other Frames, so it messed with the positioning.

This discussion is preserved as it was. New answers, comments, and votes are closed.