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

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

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?

1 comment

0

Is the LocalScript running at all?

1 answer

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

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