Animation script not working!

Hi all
I am making a horror game and i made a jumpscare animation script but for some reason that dose not work!

Here’s the script

local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local JumpScare = humanoid:LoadAnimation(animation)

wait(5)
JumpScare:Play()

Here’s the animation on the toolbox
https://www.roblox.com/library/8837805156/Jumpscare

1 Like

you should use Animator inside the Humanoid to load animations since Humanoid:LoadAnimation is deprecated!

local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local animator = humanoidt:WaitForChild('Animator')
local JumpScare = animator:LoadAnimation(animation)

wait(5)
JumpScare:Play()

if it doesnt work and there is an error, please show us the error too!

still not working without any errors do u think this has something to do with AnimSaves?

ye i think theres smth wrong with animation itself or here theres two possibilites

  1. Something wrong with the animation (usually animations not owned by you)
  2. Your animation is being overriden by default animations. If that’s the case then set AnimationPriority to Action using Animation Editor or through script
  3. or if above didnt work. Your script didn’t run, since it has no errors.

Even though the humanoid’s “:LoadAnimation()” instance method has been deprecated it can still be used to successfully load animation tracks.

What this thing said above is true, but you should use the Animator to load your animations in the future. Using deprecated functions over working ones are not suggested as it can block your path on becoming a fine scripter one day. I can see your potential as an excellent boi of scripter, so do the best!