We use cookies on this site to enhance your user experience
Collapse Sidebar


Increments the AnimationTrack/TimePosition of all playing AnimationTracks that are loaded onto the Animator, applying the offsets to the model associated with the Animator. For use in the command bar or by plugins only.

The deltaTime paramater determines the number of seconds to increment on the animation’s progress. Typically this function will be called in a loop to preview the length of an animation (see example).

Note that once animations have stopped playing, the model’s joints will need to be manually reset to their original positions (see example).

This function is used to simulate playback of Animations when the game isn’t running. This allows animations to be previewed without the consequences of running the game, such as scripts executing. If the function is called whilst the game is running, or by Scripts or LocalScripts, it will return an error.

Developers designing their own custom animation editors are advised to use this function to preview animations, as it is the method the official Roblox Animation Editor plugin uses.


Name Type Default Description

The amount of time in seconds animation playback is to be incremented by.


Return Type Summary

Code Samples

Preview Animation in Studio

This code sample includes a function that can be used to preview an Animation on a Model in Roblox Studio, without needing to run the game. It utilizes the Animator.StepAnimations function, which is the same method the official Roblox Animation Editor uses.

    local RunService = game:GetService("RunService")
    local function studioPreviewAnimation(model, animation)
    	-- find the AnimationController and Animator
    	local animationController = model:FindFirstChildOfClass("Humanoid") or model:FindFirstChildOfClass("AnimationController")
    	local animator = animationController and animationController:FindFirstChildOfClass("Animator")
    	if not animationController or not animator then
    	-- load the Animation to create an AnimationTrack
    	local track = animationController:LoadAnimation(animation)
    	-- preview the animation
    	local startTime = tick()
    	while (tick() - startTime) < track.Length do
    		local step = RunService.Heartbeat:wait()
    	-- stop the animation
    	-- reset the joints
    	for _, descendant in pairs(model:GetDescendants()) do 
    		if descendant:IsA("Motor6D") then
    			local joint = descendant
    			joint.CurrentAngle = 0
    			joint.Transform = CFrame.new()