Hi Creators,
Today, we’re releasing State Machines and Luau Expressions as a Studio beta for the Animation Graph Editor, which came out of beta in July.
State machines embedded in AnimationGraphs let you describe the flow of animation through various states that aren’t driven by Gameplay state (via explicit parameters). In a sword combo, a character can go from Swing 1 to Swing 2, but it can’t go from Idle directly to Swing 2 unless you wire a transition between them.
Before this update, the graph didn’t track which state a character was in. The existing Priority Select node checks all of its conditions every frame, so a check meant to move from Swing 1 to Swing 2 could also fire while the character is still in Idle. To avoid that, you had to track the state yourself in a Luau script and pass it to a Select node. With the State Machine, you can lay out the states and the transitions between them directly in the graph.

Set Up States and Transitions in the Graph
Add a State Machine node and open it. You’ll see its states and the transitions between them, with one state marked as Entry. A state can be any node in the graph that outputs a pose.
For each transition, write the condition as a Luau expression over your graph parameters, such as Speed > 5 (expressions are covered in the next section), or set the transition’s Wait For to Finished to transition when a state finishes, and set a Length and Curve for the blend. Transitions wired from the (Any) state can fire from every other state in the state machine (e.g. a transition from (Any) to Holster when IsEquipped == false lets the character put the sword away mid-combo). When two transitions could fire on the same frame, the one with the higher Priority wins. Each priority value has to be unique within the state machine.
Your script still sets the parameters, but it doesn’t need any transition logic:
RunService.Heartbeat:Connect(function()
local speed = humanoid.MoveDirection.Magnitude * humanoid.WalkSpeed
animationTrack:SetParameter("Speed", speed)
end)
Write Parameter Math in One Node
An expression is a line of Luau that sets a node property or a transition condition. Before, you’d compute the value in a script and pass it in. For example, this expression turns movement speed into a blend weight between 0 and 1:
math.clamp((movementSpeed + 0.5) / maxSpeed, 0, 1)

Each expression is parsed once when the graph loads and is evaluated when a node uses it. Expressions are serialized and published with the graph asset instead of living somewhere in a script.
To add an expression, drag a wire from a property pin and choose Expression, or use the Insert menu.

Supported Syntax:
- Arithmetic:
+,-,*,/,^,%, and// - Comparisons, plus
and, or,andnot - Conditional statements:
if speed > 10 then "sprint" elseif speed > 2 then "run" else "idle" - The math library, such as
math.clamp(),math.sin(), andmath.max() Vector3.new()and member access likemoveDir.Magnitudeorposition.X- String concatenation with
.. - Multi-line expressions with
localvariables and non-nested if/else statements
Expressions are currently limited to the above syntax and don’t support loops, function definitions, tables, require(), method calls like obj:Method(), libraries other than math, or DataModel access. Use a script for anything else. While previewing the graph in the Graph Editor or play-testing, If an expression fails to parse or evaluate while you preview or playtest, you’ll see an error in the Output window.
Improvements Since Full Release
We’ve also shipped these fixes since July 15:
- Server Authority: Graphs use less bandwidth. Large graphs are less likely to overflow the attribute size limit or print errors when bound with
BindToSimulation(). - Blend Nodes: Blend2D accepts negative Y values, and collapsed Blend2D nodes resize correctly. Blend maps now render the first time you open them.
- Sequence Nodes: Sequence and Random Sequence support
When = BeforeFinished. Use this setting to transition from the end of the active input to the start of the next input. - New Node Type: The One Shot node plays a one-shot pose on top of a base pose, then resets. Use Trigger parameters so they reset automatically. More details here.
- Editing: Duplicating a node no longer copies its connections. Graphs no longer load with disconnected nodes, and angle properties display in degrees.
- Reset: The toolbar Reset button resets graph state during playback.
- Create Animate Script: No longer generates an empty script.
- View > Organize: Lays out your nodes automatically.
Known Issues
- You can’t manually set a state or trigger a transition from the editor.
- Adding parameters will always add a green parameter node to the graph even if you don’t wire it to something. This will be fixed soon.
What’s Next
This is an early beta. We’ll fix bugs and adjust the design based on what you report before these features move to full release.
Resources
Please post bug reports and graphs you’ve built in the replies. Let us know if you have any questions or feedback. Thank you.
FAQs
Click to expand
Q: Can I use State Machines and Expressions in live games during the beta?
A: No. They only work in Studio at the moment.
Q: Does a State Machine replace Humanoid states?
A: No. State Machines are for animation states, such as the steps in an attack combo or a reload animation. Gameplay states like jumping or dying still come from the Humanoid or your own scripts, and you can pass them into the graph as parameters if your animations need them.
Q: Do I still need a script?
A: Yes, to set parameters from gameplay. Transition logic and parameter math can move into expressions in the graph.
Q: Can an expression read properties from my character or the workspace?
A: No. Expressions only read graph parameters. Use SetParameter() to pass anything else in.
Q: Why does the higher Priority win?
A: It matches existing Roblox conventions like Enum.AnimationPriority, where a higher number means higher priority.
Q: Should I stop using Priority Select?
A: No. Priority Select still works. A state machine is the better fit when a transition should only apply from certain states.



