Animation not working at all

In my game, I am trying to add idle animations to people in chairs.

I have tried different ways of loading the animation but it doesn’t work.

Here is the current script.

local animator = hum:FindFirstChildOfClass("Animator")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://12707957951"
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()```

This is in a server script.

Do you have any errors, or is it just not working? Also, is hum defined?

Is the humanoid defined and is the Animation placed in the Humanoid.

Also, it’s best to set the AnimationPriority to Action. https://create.roblox.com/docs/tutorials/building/animation/scripting-avatar-animations#playing-animations