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
3 years ago
Edited 3 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 — 3y
1
what do you mean? Im pretty new to roblox studio L30N_C 27 — 3y
0
dance.Priority = Enum.AnimationPriority.Action misha123 83 — 3y
0
Sorry but it is still not working L30N_C 27 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 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 — 3y
Ad

Answer this question