My burning questions about scripting

A few things:

1:I figured out how to make objects move to one side by pressing the button, but how do you make it go back to the position it was in before I pushed the button? If I press the button again, it just keeps moving the same direction over and over, but how do I make it come back by pressing the same button?

2:I thought of a fun obstacle, a boulder that rolls down a hill time after time, but when I script it to despawn, then respawn, it despawns and never comes back. I saw the Terminal remake, and I want to know how he makes the train respawn.

3:Is there a way to do this: After I press the button, one thing happens, but another thing happens after the first thing. The only thing I’ve managed to do was make 2 different things happen exactly the same time, but how do I make it one thing happens, then the other thing?

These questions are killing me, and I can’t do much of anything exiting without knowing the answers, so please help me!

1:the button:

  • on interaction -> set Power state -> togglethe object:

  • on power state -> on -> move offset x,y,z - on power state-> off’ -> Rotation/Movement reset
    2,3: did not figured out either, no idea

Gotta turn the respawn on for the boulder.

As for 3, use a scripting brain that, when it despawns, sends a message or toggles power. Let’s say a button opens one door then opens another the second time.

The button sends an Alpha message. The first door opens, and a script brain despawns at the same press of the button. When the brain despawns, have it toggle Alpha power to off. Then, when you press the button again, it sends another Alpha message. The second door should be set to open only when it recieves an Alpha message WHILE the Alpha power is off.

If you want the first door to not move the second time you press the button, then set it so it only opens when it recieves an Alpha message WHILE the Alpha power is ON, instead of off.

> 2533274808210415;3:
> As for 3, use a scripting brain that, when it despawns, sends a message or toggles power. Let’s say a button opens one door then opens another the second time.
>
> The button sends an Alpha message. The first door opens, and a script brain despawns at the same press of the button. When the brain despawns, have it toggle Alpha power to off. Then, when you press the button again, it sends another Alpha message. The second door should be set to open only when it recieves an Alpha message WHILE the Alpha power is off.
>
> If you want the first door to not move the second time you press the button, then set it so it only opens when it recieves an Alpha message WHILE the Alpha power is ON, instead of off.

While that was helpful,thank you, you did not answer my question. In case I wasn’t clear I’ll give an example. (Assume what I am about to say happens successfully)Suppose I pressed a button and a door slides open, but after 5 seconds, closes. That’s what I’m aiming for. I’m sorry if I wasn’t clear, but can someone tell me if this is possible, and if so, how?

Oh sorry. Best I can do is have a brain despawn and respawn 5 seconds later. When it respawns, it sends a message to reset the door position.