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

Help Script errors?

Asked by 9 years ago

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?

1if mouse.Target.Name ~= "HitBox" or script.Parent.Deselected then -- this is just a part of the script ignore only the mouse.Target.Name ~= "HitBox"

1 answer

Log in to vote
1
Answered by 9 years ago

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:

1selected = false
2 
3script.Parent.Selected:connect(function()
4    selected = true
5end)
6 
7script.Parent.Deselected:connect(function()
8    selected = false
9end)

Please upvote if this helped!

Ad

Answer this question