PcoWSkbVqDnWTu_dm2ix

Adding Animations

Adding Animations

To implement animations in-game, use scripts. For this tutorial, you’ll add your victory animation into a game using a pre-made script. Once finished, this animation can be used to celebrate a player’s accomplishment, like reaching the end of an obby or finding a secret.

This guide covers step-by-step how to add and modify a script. It assumes some previous knowledge of scripting and isn’t intended to teach these concepts.

For your own game, you may need to make modifications to this script. To better understand scripting, we recommend going through the Code Fundamentals series.


Scripting Animations

Set up the Project

  1. To organize all parts that will play the animation, add a folder in Workspace (hover over Workspace and click ) named TouchPartFolder.

The script provided later will play feedback for any parts in this folder that are touched. This makes organizing your game easier than attaching a script onto an individual part.


  1. In TouchPartFolder, add a part.
  1. Make sure the part is placed where playing the animation would make sense, such as the end of a level or near an object players collect.
Example Part Placements
  1. This first script attaches a Touched() event to any parts in the TouchPartFolder. Once a player touches any part there, it’ll play an animation.
To add the script, in StarterPlayerStarterCharacterScripts, create a LocalScript named TouchPartRegister. Then copy and paste the code below.
  1. The next script triggers animations for a player. In ReplicatedStorage, create a new ModuleScript named PlayerAnimationFeedback. Then, copy and paste the code below.

Previous Improve and Export Next Playing Animations