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

Animation Not Playing when clicking play?

Asked by
L30N_C 27
4 years ago
Edited 4 years ago

So i have a animation script on my NPC but the problem is that it only works when clicking run and not when clicking play or play here, why is that?

here is the animation script

local animation = script:WaitForChild('WaveAnim')
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
dance:Play()
dance.Looped = true

1
make sure the priority is the right priority srimmbow 241 — 4y
1
what do you mean? Im pretty new to roblox studio L30N_C 27 — 4y
0
dance.Priority = Enum.AnimationPriority.Action misha123 83 — 4y
0
Sorry but it is still not working L30N_C 27 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

I inserted my character in the game and i am loading the run animation. Here is the script i made (it work also when i press play, run, play here):

--Getting the animation
local Animation = script:WaitForChild("RunAnim")
--Getting the Humanoid
local Humanoid = script.Parent:WaitForChild("Humanoid")
--Loading The Animation
local LoadedAnimation = script.Parent.Humanoid:LoadAnimation(Animation)
--Setting the animation so it will not stop
LoadedAnimation.Looped = true
--Playing the animation
LoadedAnimation:Play()
0
Change the 2nd line to: local Animation = script:WaitForChild("WaveAnim") dionsyran2 66 — 4y
Ad

Answer this question