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

How can i make a GUI element follow the mouse?

Asked by 8 years ago

for example how can i make it to where when a mouse right clicks the Gui Element it will fade in a Hint that is right under the mouse until the mouse leaves the element. I know MouseEnter and MouseButton1Click, etc. But i have no idea how to make the hint follow the mouse.

1 answer

Log in to vote
0
Answered by 8 years ago

MouseObjects have two values:

Mouse.X -- 2d horizontal position
Mouse.Y -- 2d vertical position

Then, just make a while loop that repeatedly does this:

while HintIsOn == true do
    Gui.Position.Y = Mouse.Y
    Gui.Position.X = Mouse.X
    wait()
end

Hope I helped (note: these properties are read only) :)

0
Cool This worked! Thank you for helping me, Now i've learned something new that i can use to my advantage on my next projects. :) alberthutchins 12 — 8y
0
No problem :) TheDeadlyPanther 2460 — 8y
Ad

Answer this question