Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Freeze the animation at a certain point?

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago

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.

0
oh wow never thought u can set it to 0! thank you :) iiAngelie123 40 — 7y
Ad

Answer this question