Dalal wrote:I think you need one more layer of logic. Let's replicate the mechanics of a button. Think of your button as having two states: 'down' and 'up'. When a player is overlapping your button, you want the button to be 'down'. When a player is NOT overlapping your button, you want the button to be 'up'. Let's put these mechanics in event form: add a Boolean instance variable to your button called "isDown". When Player1 or Player2 is overlapping Button, set isDown to True. If neither is overlapping, set isDown to False.
Now we have a button that is either in a down state or up state (behind the scenes), depending on whether a player is standing on it. You want to link up your StartLava events to the state of your button. Basically, when the button is pushed (i.e isDown first becomes True), we want to toggle StartLava (set StartLava to 1-StartLava). To do this, we can use the "Trigger Once" condition. Our logic will look something like this: Button.isDown is True and Trigger Once, set StartLava to 1-StartLava.
Now, every time isDown changes to True from False, StartLava will toggle. If a player steps on the button (changing isDown to True), and another player steps on it later (keeping isDown as True), because there was no change in button state, StartLava will remain the same, as you would like it to.
EDIT: Or a simpler but conceptually similar approach would be: When either Player 1 or Player 2 is overlapping the button, in a Trigger Once SUBEVENT, toggle your StartLava variable.
This should work similarly.
Wow man you're amazing, not only this worked perfectly, but it's also far easier than all the solutions I tried before!
Like you suggested, I set a boolean to the button that checks if it's currently pressed or not. This solved the two players problem, since if player2 steps on the button while player1 is already on it, the button remains "IsDown=True" regardless.
After this, I've added an event which says:
Button IsDown + Trigger Once= Set StartLava to 1-Startlava
And bam, it now works perfectly.
Thank you a lot!
P.S. The "Set StartLava to 1-Startlava" you told me to use is amazingly smart and far better than the 2 events I used before ("if Startlava=0 > set StartLava to 1" + "if Else > Set StartLava to 0"). I still have to get in the correct mindset to use this program...