Make blocks disappear in a sequence

Last updated: February 10, 2025

Make sure to have claimed a plot, be in 'Create' mode, and press the 'Build' button on the left side of the screen until you see a toolbar appear on the right side of the screen.

This code will teach you how to make blocks disappear one after another, perfect for an obby!

  1. Create a block in your plot. Select the block, and press the Code Builder button on the toolbar. This should open a 'Properties' tab with the options, 'Save' and 'Code Builder'. Press 'Code Builder'. This should lead you to the Code Builder tab.

  1. In Code Builder, go to 'Events' on the left and grab the At start block. Then go to control and grab the wait -- seconds block and the do forever block. Place the At start block followed by the wait -- seconds block right below it, and the do forever block and the very bottom. Your code should look like this:

  1. Now let's make the disappearing block function! Refer to this article for a further explanation regarding how the code works, but essentially we want to get the object to go transparent and be un-collidable, and make it appear again after some time. For this we want to go to 'Looks', grab the Tween transparency to - in - seconds block, and place it in between do forever and end. Input 1 in tween transparency to make the object completely transparent, and input the duration of time you want the object to transition to complete transparency. I'll set it to 3 seconds now.

  2. Go to 'Motion' and grab the set collidable True block, and set it to 'False'. This will make the object un-collidable. Place this block right below the Tween transparency block, then go to 'Control' again and **grab another ** wait -- seconds block, and place it right below your set collidable block. This wait -- seconds indicates how long the object disappears for, so input whatever duration you'd like (I input 3 seconds).

At this point, your code should look like this :

  1. Now we want to make the object appear again after the 3 seconds, so let's duplicate all the blocks between do forever and end and place them right below wait 3 seconds. We'll reverse the values, setting transparency to 0 and collidable to True, so it appears instead of disappears. We also want to add 3 seconds to our new wait -- seconds block to account for the time it takes for the object tween fully transparent, so in this case it will be 6 seconds. Your code should look like this now :

  1. Don't forget to save your code, and let's go back to our plot. Duplicate your object and select it, and open Code Builder for that object. You should see that the code is exactly the same as the original object, with the exact same values.

7. Click the 'unlink' button on the top left side of the Code Builder to unlink this object from the previous one, so you can edit the code without affecting the original object as well. The button should go gray once it is successfully unlinked. 8. Now all that's left to do is to change the wait -- seconds block right below the At start block. As we want this object to disappear after the original object, we want to set it to more than the value in the original code. I want this object to disappear 1 second after the original object starts disappearing, so I'll set it to 2 seconds.

  1. Now comes the repetitive part - with however many objects you wish to have disappear in a sequence, you need to do the same process - duplicate, unlink, change the wait -- seconds value. Each object should have a different amount of time for wait -- seconds, or they will disappear at the same time instead of one after another. Don't forget to save your code after each one!

  2. After all that's done, you can press 'play' and you should start to see your objects disappearing in a sequence!

Was this article helpful?

Thanks for your feedback!