Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Freeze the animation at a certain point?

i was just wondering that if i could freeze the time of the animation at the certain point? or frame because i was making an Action Gui to make a certain action and i want it to hold it at the end after the animation has being played i tried removing the Loop on the Animation using animation Editor and tried to play it using script on the gui and still stops the animation

the point is that i want the animation to stop at the end of the animation and hold it there until the player clicks again to stop the animation.

this is my script btw, on my current animation i just didn't put any action on it but looped the way it looks like your freezed in a position that i want it to look like

repeat wait() until game.Players.LocalPlayer.Character

player = game.Players.LocalPlayer
animation = script:WaitForChild("Animation")
enabled = false
print("Action1 Variables loaded")

script.Parent.MouseButton1Click:connect(function()
	if enabled == false then
		enabled = true
		player.Character.Humanoid.WalkSpeed = 0
	anim = player.Character.Humanoid:LoadAnimation(animation)
	anim:Play()
	elseif enabled == true then
		enabled = false
		player.Character.Humanoid.WalkSpeed = 16
		anim:Stop()
		end
end)

player.Character.Humanoid.Changed:connect(function()
	if player.Character.Humanoid.Jump == true and enabled == true then
		player.Character.Humanoid.Jump = false
	end
end)

1 answer

✓ Accepted answer

To freeze an animation at any point of time you can simply set the speed to 0. This can be done by using the method:AdjustSpeed(float) on the animation track. This value defaults to 1. This is what it looks like when done.

local track = player.Character.Humanoid:LoadAnimation(Animation)
track:Play()
wait()
track:AdjustSpeed(0) -- stopping animation at its current frame.

You can manipulate this to work at certain keyframes if you please.

1 comment

0

oh wow never thought u can set it to 0! thank you :)

This discussion is preserved as it was. New answers, comments, and votes are closed.