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

How would one detect a mouse hovering over a billboard GUI?

Asked by 6 years ago

Okay, this is the code we're working with. It's a local script placed inside a billboard GUI inside the head of a player's character.

-- variables --
Player = game.Players.LocalPlayer

Group = script.Parent
HitBox = Group.HitBox
Name = Group:FindFirstChild("Name")
Role = Group.Role

-- functions --
function DisplayUsername()
    RoleplayName = Name.Text
    Name.Text = Group.Parent.Parent.Name
end

function DisplayRoleplayName()
    Name.Text = RoleplayName
end

-- events --
HitBox.MouseEnter:connect(function()
    DisplayUsername()
end)

HitBox.MouseLeave:connect(function()
    DisplayRoleplayName()
end)

The issue is that for whatever reason, the HitBox (a textbutton) isn't picking up a mouse hovering over the GUI. I know this because I used breakpoints.

Yes, the script must be client-sided. I've already tried the same thing with a frame.

What am I doing wrong here?

0
Is the LocalScript running at all? User#6546 35 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

It doesn't seem to be possible to just use MouseEnter and MouseLeave events for BillboardGuis, so I have 2 ideas

1. Use a part and rotate it locally to make it look like it's facing players' screens and put SurfaceGuis on it

2. Use WorldToScreenPoint along with some fancy math to see if the mouse is within the boundaries of a frame or whatever's edges

Ad

Answer this question