UevKF8zjRV_WEtpJsXhr
We use cookies on this site to enhance your user experience

WaitForChild() Helps Avoid Run-time Errors

Because scripts in Roblox run at different times, it’s possible that a player’s head might not be created yet. To avoid errors, like trying to find a part that doesn’t exist, the script uses WaitForChild() to get the head part attached to the player’s character instead of using the dot operator, like player.Head.


  1. Add a wait function and destroy the particles after one second.
  1. Playtest the game and make sure particles briefly follow the player after touching each color.
Troubleshooting Tips
  • Make when creating a new instance that ParticleEmitter is spelled exactly as shown and inside quotations.
  • When parenting the particles, make sure to use : between playerCharacter and WaitForChild() with no spaces between.

Finished Project Sample

Project File

Download the finished project here.

Finished Script