Animation Events

You can define animation event markers across the timeline span and use GetMarkerReachedSignal() to detect those markers as the animation runs.

Showing Events

By default, the event track isn't visible. To show the event track:

  1. Navigate to the right of the timeline, then click the Gear icon. A pop-up menu displays.

  2. Select Show Animation Events. This opens the Animation Events bar directly below the media and playback controls.

You can now create, detect, and duplicate events.

Creating Events

Event markers are visual indicators of where an animation event begins. After you create an event marker, you can move it to any frame position on the timeline.

To create a new event marker:

  1. Navigate to the timeline, then click-and-drag the scrubber to the frame position where the event should occur.

  2. Navigate to the event track, then click the Edit Animation Events button. The Edit Animation Events dialog displays.

  3. In the Edit Animation Events dialog, click + Add Event, then enter an event name.

  4. (Optional) In the Parameter field, enter a parameter string for the event.

  5. Click the Save button. In the events bar within the timeline, a new marker symbol displays at the frame position.

Detecting Events

To detect animation events in a LocalScript, connect a function to the GetMarkerReachedSignal() function of AnimationTrack. For example:


1local Players = game:GetService("Players")
2
3local player = Players.LocalPlayer
4local character = player.Character
5if not character or not character.Parent then
6 character = player.CharacterAdded:Wait()
7end
8local humanoid = character:WaitForChild("Humanoid")
9local animator = humanoid:WaitForChild("Animator")
10
11-- Create new "Animation" instance
12local walkAnim = Instance.new("Animation")
13-- Set its "AnimationId" to the corresponding animation asset ID
14walkAnim.AnimationId = "rbxassetid://5432167890"
15
16-- Load animation onto the animator
17local walkAnimTrack = animator:LoadAnimation(walkAnim)
18
19-- Connect "GetMarkerReachedSignal" event to a specific named keyframe
20walkAnimTrack:GetMarkerReachedSignal("FootStep"):Connect(function(paramString)
21 print(paramString)
22end)
23

Duplicating Events

As you create events, they become available for usage throughout the whole animation, not only at the frame position where you originally created them. For instance, you can create a "FootStep" event marker at the point where a character's left foot touches down, then use the same event when the character's right foot touches down.

To duplicate an event:

  1. Navigate to the timeline, then click an event marker in the event bar.

  2. Press Control + C (Command ⌘ + C on Mac).

  3. Click-and-drag the scrubber to the frame position where you want to duplicate the event.

  4. Press Control + V (Command ⌘ + V on Mac).

If the original event uses a parameter but the duplicated event should use a modified parameter, perform the following steps:

  1. Right-click the duplicated event marker. A pop-up menu displays.
  2. Select Edit Animation Event. The Edit Animation Events dialog displays.
  3. Make your changes, then click the Save button.