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

Touch Remove Script Saying that Object is Wrong AND Right?

Asked by
acuaro 29
4 years ago

I'm building a game and a simple feature is that you drag objects into a machine that then detects if its right or wrong ( in this case, junk is wrong and eggs are right). The problem is, when I go to test the game, I put in an egg ( which is right) into the machine and the output returns with this

``obj is right

Then below it will say

``obj is wrong

I tried this with a wrong thing ( junk) and it still returned this. There was no error and I'm really stuck and confused. Here is the script which is located in a part which is the detector

 script.Parent.Touched:Connect(function(obj)
    if obj.Name == "object1" or "object2" or "object3" or "object4" then
        print("obj is right")
        obj:remove()
    end

    if obj.Name ~= "object1" or "object2" or "object3" or "object4" then
        print("obj is wrong")
        obj:remove()
    end
end) 

I don't know what the problem is and I can't really narrow it down either. If you could help, that would help a lot!

Acuaro

NOTE --The code is located inside of a Script

Answer this question