How to detect if mouse hovers over part without click detector

I want to make a Boolean of if mouse is hovering over part or not
Example : if mouse hovering over part then
Hover = true / if mouse not hovering over part then Hover = false


this script may work but im not sure

lp = game.Players.LocalPlayer
mouse = lp:GetMouse()
if mouse.Target:IsA('BasePart') and mouse.Target:FindFirstChildOfClass('BillboardGui') ~= nil then
if mouse.Target:FindFirstChildOfClass('BillboardGui').Enabled == false then
mouse.Target:FindFirstChildOfClass('BillboardGui').Enabled = true
mouse.Target:FindFirstChildOfClass('BillboardGui').Enabled = false

I want it per part tho , so if the mouse hovers over the part, a surface GUI pops up with its name

like if a part is named “HoverPart” the gui will come up?

If you have ever played “my little blacksmith shop” like when you hover over an item it says the items name

ive updated the script to what i think you want, tell me if thats not it tho

I want to turn on a billboard GUI that’s in the partimage

No basically I want to make it so where if the mouse hovers over the part the GUI turns on , if it’s not hovering over the part then the GUI turns off

Going on with what @hockeylover29 suggested, you can check if there is a Target:

if mouse.Target then

In which this checks if the mouse is hovering to something that exists in the Workspace. As for every part, maybe have a table in which it stores which GUI will appear? That’s my suggestion, but you can change it.

Can u elaborate on the table approach

ive updated the script again if you wanna see if that works out for ya

1 Like
local Items = {
    ["Item1"] = GUI1
    ["Item2"] = GUI2

if Items[mouse.Target.Name] then
    Items[mouse.Target.Name].Visible = true

It can be like this, or you can use CollectionService.

Basically, if it is found in the table, the GUI that is inside the key will be visible.


The script wouldn’t work because if it’s an else then it wouldn’t have the GUI

did not see that, i think i updated the script so it would work (nvm it would just end up flashing the gui, but the script roughly is what it would look like if you still wanna go off of the target approach)

1 Like

The problem is that u can’t store a billboard GUI in a table. So the dilemma I’m in is that if I use any else statement then it starts flashing if I use the table approach then 2 parts with the same name would break the script

Also if I used collection services I would have to independently tag every name able block

you could potentially bind an if check to mouse:GetPropertyChangedSignal(‘Target’):Connect(function() to make sure it only fires once every time it sees a new part


But that would make it fire once per server if multiple players looked at the same part it would only fire for 1( filtering enabled)

why would you want the billboardgui to be active on the server? It would be easier to put this in a localscript and just let the clients control if they see it or not

1 Like

Also what would be changing I’m kinda