I am making a multiplayer door, so multiple people have to be on the buttons. _2P and _1P are those button values that make everything run.
But my door script does not work. The script looks like this:
if (script.Parent.Parent._1P.Value == true) and (script.Parent.Parent._2P.Value == true) then
print(“Both players there!”)
script.Parent.Transparency = 1
script.Parent.CanCollide = false
end
I have tried switching it to a while - do loop, checked the values and they work, so everything except this works. Please help.
the “then” is on the second row for whatever reason, it’s not like that in studio
Placing code inside a script with no event or loop running it means that it will run once and never again.
So, you either use a while true do, as you said, or connect it to an event, like a ClickDetector.
If you want your script to show up properly so others can read it, just type 3 backwards single quotes before and after the script when you paste it in here
Well, without a loop or event it literally checks if the values are true at the start of the game (or when the script first runs if it’s disabled at first) and that’s it.
I have found a workaround, but this issue is still not fully resolved. My workaround was to have the second player’s door open when the first player presses his button, so both are required, but this may be exploitable.