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!
01 | local animation = Instance.new( 'Animation' ) |
02 | animation.AnimationId = "http://www.roblox.com/Asset?ID=120735762" |
03 |
04 | function onEquip() |
05 | script.Parent.Handle.UnsheathSound:Play() |
06 | end |
07 |
08 | function onActivate() |
09 | script.Parent.Handle.SlashSound:Play() |
10 | local player = game.Players.LocalPlayer.Character |
11 | local animTrack = player.Humanoid:LoadAnimation(animation) |
12 | animTrack:Play() |
13 | script.Parent.Handle.Script.Disabled = false |
14 | end |
15 |
16 | script.Parent.Equipped:connect(onEquip) |
17 | script.Parent.Activated:connect(onActivate) |
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.