Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get the mouse position relative to an GUIObject?

Asked by
Griffi0n 315 Moderation Voter
6 years ago

Basically I am trying to detect the mouse position relative the position of a GUI Element. Currently this is what I have:

UDim2.new(0, Mouse.X*Object.Position.X.Scale, 0, Mouse.Y*Object.Position.X.Scale)

But that isn't quite working and setting the AnchorPoint is not helping.

1 answer

Log in to vote
2
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

You can use: ~~~~~~~~~~~~~~~~~

UDim2.new(0, Mouse.x-GuiObj.Parent.AbsolutePosition, 0, Mouse.y-GuiObj.Parent.AbsolutePosition) ~~~~~~~~~~~~~~~~~

0
thanks Griffi0n 315 — 6y
Ad

Answer this question