# ActionSequence

ActionSequence : `Instance`

## Overview

An ActionSequence is an instance that allows you to compose animations, effects, camera work, and other elements for a single action in an integrated timeline. It provides a visual, timeline-based editing environment to configure commonly used in-game sequences and script execution timing.

ActionSequences are defined as **static data objects** and cannot be created directly at runtime using Instance.new or Clone.

When execution is requested via the Play method on the **ActionRunner** under a Humanoid, the original ActionSequence instance is **cloned** into Humanoid.ActionRunner, and the action is executed based on the cloned instance.

Due to this structure, when c**onnecting events within ActionSequence scripts**, you must reference the runtime duplicated instance rather than the original instance. Therefore, instead of using absolute paths, you should **reference based on script.Parent**.

Events can be connected in both server and client environments. However, **server-side Scripts are recommended to be placed directly under the ActionSequence**, as they may not function properly when placed deeper in the hierarchy.

**If events are connected in a LocalScript under the ActionSequence, the logic will be executed on all clients**. Therefore, you should filter based on the executor (self) of the ActionSequence when necessary.

## Properties

## Methods

### TriggerStarted

Returns an event that fires when a trigger with the given name, defined in the ActionSequence’s trigger track, starts.

#### Parameters

| `string` TriggerName | The name of the trigger. |
| -------------------- | ------------------------ |

#### Return

| `ScriptSignal` | The trigger started event. |
| -------------- | -------------------------- |

#### Code Samples

```lua
local ActionSequence = script.Parent

-- self : The character model that executed the ActionSequence is passed.
ActionSequence:TriggerStarted("TriggerName"):Connect(function(self)
    -- ...
end)
```

### TriggerEnded

Returns an event that fires when a trigger with the given name, defined in the ActionSequence’s trigger track, ends.

#### Parameters

| `string` TriggerName | The name of the trigger. |
| -------------------- | ------------------------ |

#### Return

| `ScriptSignal` | The trigger ended event. |
| -------------- | ------------------------ |

#### Code Samples

```lua
local ActionSequence = script.Parent

-- self : The character model that executed the ActionSequence is passed.
ActionSequence:TriggerEnded("TriggerName"):Connect(function(self)
    -- ...
end) 
```

### Hit

Returns an event that fires when a marker with the specified name, defined in the ActionSequence’s collision track, is reached.

#### Parameters

| `string` InCollisionEventName | The name of the collision event. |
| ----------------------------- | -------------------------------- |

#### Return

| `ScriptSignal` | The collision event. |
| -------------- | -------------------- |

#### Code Samples

```lua
local ActionSequence = script.Parent

-- self : The character model that executed the ActionSequence is passed.
-- other : The target object detected by the collision check (character model or Part) is passed.
ActionSequence:Hit("CollisionEventName"):Connect(function(self, other)
    -- ...
end)
```

### GetMarkerReachedSignal

Returns an event that fires when a marker with the specified name, defined in the ActionSequence’s event track, is reached.

#### Parameters

| `string` MarkerName | The name of the marker. |
| ------------------- | ----------------------- |

#### Return

| `ScriptSignal` | The marker reached event. |
| -------------- | ------------------------- |

#### Code Samples

```lua
local ActionSequence = script.Parent

-- self : The character model that executed the ActionSequence is passed.
ActionSequence:GetMarkerReachedSignal("EventName"):Connect(function(self)
    -- ...
end)
```

## Events

## See also

{% content-ref url="../../../manual/studio-manual/game-development/actionsequence" %}
[actionsequence](https://docs.overdare.com/manual/studio-manual/game-development/actionsequence)
{% endcontent-ref %}

{% content-ref url="../../../manual/studio-manual/game-development/actionsequence/running-actionsequences" %}
[running-actionsequences](https://docs.overdare.com/manual/studio-manual/game-development/actionsequence/running-actionsequences)
{% endcontent-ref %}
