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?

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"

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:

selected = false

script.Parent.Selected:connect(function()
    selected = true
end)

script.Parent.Deselected:connect(function()
    selected = false
end)

Please upvote if this helped!

Ad

Answer this question