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

Play Animation, But Go Back To Default Animation When Done Playing?

Asked by 8 years ago

So after this script plays the animation, I want it to go back playing Roblox's character default animations, but it stays as the animation listed below. How do I make this happen? Thanks!

local animation = Instance.new('Animation')
animation.AnimationId = "http://www.roblox.com/Asset?ID=120735762"

function onEquip()
    script.Parent.Handle.UnsheathSound:Play()
end

function onActivate()
    script.Parent.Handle.SlashSound:Play()
    local player = game.Players.LocalPlayer.Character
    local animTrack = player.Humanoid:LoadAnimation(animation)
    animTrack:Play()
    script.Parent.Handle.Script.Disabled = false
end

script.Parent.Equipped:connect(onEquip)
script.Parent.Activated:connect(onActivate)
0
When do you want the animation to end? BinaryResolved 215 — 8y
0
I want it to end when the animation finishes GatitosMansion 187 — 8y

1 answer

Log in to vote
0
Answered by
einsteinK 145
8 years ago

I assume the Animation has Loop set to true? You could reupload the animation with looping disabled. Another way is just doing animTrack:Stop() when you want. Maybe animTrack.Stopped:connect() can help, although I'm not sure if that fires for a looping animation.

0
animTrack:Stop() works, thanks! GatitosMansion 187 — 8y
Ad

Answer this question