Make objects fade in and out using Code Builder

Last updated: February 19, 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.
  1. Select an object you want to animate (Note - object has to be an individual part, as the code builder does not work for objects made out of grouped parts). On the toolbar on the right side, select 'Code'. You should see a Properties tab open with the options 'Save' and 'Code Builder'. Press 'Code Builder' to open the block scripting tab.

  2. Once you're in the code builder, name your script and the object you're applying the code to. After that we can start building the code.

  3. On the left side of the Code Builder, go to 'Events' and grab the At Start block. This is to indicate when the code will start - without an Events block, the code will not run.

  4. After, go to 'Control' on the left side and grab the do forever block so the code runs throughout your play session, and place it below your At start block. It should look like this :

  5. On the left, go to 'Looks' and grab the tween transparency to - in - seconds block, and place it in between do forever and end. Set tween transparency to 1 to make the object completely fade out, and set the amount of time taken for them to fade out (5 in this case, for a smoother transition).

  6. Duplicate your tween transparency block and place it just below your previous tween transparency block, but this time set tween transparency to 0. This makes the object fade back in.

  7. Go to 'Control' and grab the wait - seconds block and place it in between your two purple tween transparency blocks - this block indicates the delay before you want the next block to run. In this case, we want to wait until the object completely fades out before running the next block to fade them back in, so set the wait - seconds to at least 5 seconds (I set it to 5.5 seconds just in case).

  8. Duplicate your wait - seconds block and place it below the tween transparency to 0 block. This creates a repeatable sequence for the Code to do forever - fade out, wait for 5.5 seconds, fade in, wait for 5.5 seconds, repeat. At this point, your Code should look like this :

  1. Save the code by pressing the save button just below the Code title, and press 'play my game' to see your object fading in and out. You can simply adjust the values to make different effects (eg. flickering, slow reveal). Enjoy!

Was this article helpful?

Thanks for your feedback!