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() mouse.Move:Connect(function() 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 else mouse.Target:FindFirstChildOfClass('BillboardGui').Enabled = false end end end)
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 part
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
local Items = {
["Item1"] = GUI1
["Item2"] = GUI2
}
if Items[mouse.Target.Name] then
Items[mouse.Target.Name].Visible = true
end
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)
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
Also what would be changing Iâm kinda