Roblox moves State Machine and Expression nodes out of beta in Animation Graph Editor

State Machine nodes limit a character to the transitions you configure, and Expression nodes run a line of Luau inside the graph.

Share

Published 2 min read

Cover for the story about State Machines and Luau Expressions in Animation Graphs
Image: Arte: jkit.tools

In brief

  • Roblox released State Machine and Expression nodes in the Animation Graph Editor, out of beta.
  • State Machine nodes track a character's animation state and allow only the transitions you've wired up.
  • Expression nodes run a line of Luau for property values or transition conditions, within a limited syntax.

Roblox released State Machine and Expression nodes in the Animation Graph Editor as a full feature, no longer in beta. State Machine nodes keep track of which animation state a character is in and only allow the transitions you've wired up, while Expression nodes let you write a line of Luau inside the graph to calculate a property value or a transition condition.

Within a state machine, the (Any) state lets a transition fire from every other state, so a transition from (Any) to Holster when IsEquipped == false lets a character put the sword away in the middle of a combo. Expressions have a limited syntax: loops, function definitions, tables, require(), method calls like obj:Method(), libraries other than math and DataModel access are not supported, so anything else belongs in a script.

To add a state machine, right-click the canvas in the Animation Graph Editor and choose Insert Node > State Machine. Any node that outputs a pose, such as a Clip, Blend1D or another State Machine, connects to the node's New Input pin, and each input becomes a state. Clicking Open on the node lets you edit states and transitions, and states can also be added from the toolbar with Create State or by right-clicking the canvas and choosing Add State.

Dragging from one state to another creates a transition, which you then click to edit. (Entry) marks where the state machine starts, and you connect it to your starting state.

A transition's Wait For setting can be Expression, which fires when a Luau condition over your graph parameters is true, such as Speed > 5, or Finished, which fires when the current state's animation ends. Looping states finish at the end of each loop. When more than one transition can fire on the same frame, the one with the higher Priority wins, and each Priority must be unique within a state machine.

Expressions support arithmetic (+, -, *, /, ^, % and //) and comparisons, including == and ~= against nil, along with and, or and not. They also handle conditionals such as if speed > 10 then "sprint" elseif speed > 2 then "run" else "idle".

The math library is available, including math.clamp(), math.sin() and math.max(), as are Vector3.new() and member access like moveDir.Magnitude or position.X. Multi-line expressions work with local variables and non-nested if/else statements.

Coming in

  • State Machine

Full patch notes

Changes from the official notes
AreaChange
> State MachineState Machine nodes track which animation state a character is in and only allow the transitions you've wired up
> ExpressionExpression nodes let you write a line of Luau in the graph to calculate a property value or a transition condition
Set Up States and Transitions > State MachineRight-click the canvas and choose Insert Node > State Machine
Set Up States and Transitions > State MachineAny node that outputs a pose connects to the State Machine's New Input pin; each input becomes a state
Set Up States and Transitions > State MachineOpen edits states and transitions; states can also be added with Create State or Add State
Set Up States and TransitionsDragging from one state to another creates a transition
Set Up States and Transitions > (Entry)(Entry) is where the state machine starts; connect it to your starting state
Set Up States and Transitions > (Any)(Any) lets a transition fire from every other state
Set Up States and Transitions > Wait ForWait For: Expression fires on a true Luau condition; Finished fires when the state's animation finishes
Set Up States and Transitions > LengthLength sets how long the blend between two states takes, in seconds
Set Up States and Transitions > CurveCurve sets the easing curve of the blend
Set Up States and Transitions > PriorityPriority: when several transitions can fire on the same frame, the higher Priority wins; it must be unique within a state machine
Write Parameter Math in an Expression > Supported SyntaxExpressions support arithmetic: +, -, *, /, ^, % and //
Write Parameter Math in an Expression > Supported SyntaxExpressions support comparisons, including == and ~= against nil, plus and, or and not
Write Parameter Math in an Expression > Supported SyntaxExpressions support if/elseif/else conditionals
Write Parameter Math in an Expression > Supported SyntaxExpressions support the math library, such as math.clamp(), math.sin() and math.max()
Write Parameter Math in an Expression > Supported SyntaxExpressions support Vector3.new() and member access like moveDir.Magnitude or position.X
Write Parameter Math in an Expression > Supported SyntaxExpressions support string concatenation with ..
Write Parameter Math in an Expression > Supported SyntaxExpressions support multi-line expressions with local variables and non-nested if/else statements
Write Parameter Math in an Expression > Supported SyntaxExpressions don't support loops, function definitions, tables, require(), method calls, libraries other than math, or DataModel access
ResourcesAnimation Graph Editor documentation
ResourcesState Machine documentation
ResourcesExpressions documentation
ResourcesSample place
Source: Roblox
Share

How this story was made

Drafted with the help of artificial intelligence from a fact sheet built on the sources listed below. Software checked its numbers, dates and names against that fact sheet, and Vynuo, the editor in charge, approved the text before it was published.

Sources for this story

How we know: information from an official source (Roblox), checked on November 20, 2026.

  1. Official[Full Release] State Machines and Luau Expressions in Animation Graphs (opens in a new tab)Roblox, accessed November 20, 2026

Topics

More in Games