So i have a hopper bin and this tests if your tool is on a brick with a name it will glow and my only problem is when they unequipped the weapon it still glows. so I made this line, but it does not work help?
if mouse.Target.Name ~= "HitBox" or script.Parent.Deselected then -- this is just a part of the script ignore only the mouse.Target.Name ~= "HitBox"
Deselected is an event, not a boolean value. If you want to check if the Hopperbin was deselected then you could make your own boolean variable, and change it when the Hopperbin is selected or deselected, like this:
selected = false script.Parent.Selected:connect(function() selected = true end) script.Parent.Deselected:connect(function() selected = false end)
Please upvote if this helped!