Animation not playing

My animation isn’t playing

event.OnServerEvent:Connect(function(plr)

print("Debug")
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
	
local animTrack = hum:LoadAnimation(anim)
animTrack:Play()

end)

Debug is printing but the animation still does not play (server script)

What is the priority of the animation? Also have you tried running the animation locally because I think it replicates

Animations should always be played locally and will automatically replicate, also ensure that the priority of the animation is action in the animation editor.

already tried playing it locally (but you’re supposed to be able to play it on the server), and it is set to action (even tried manually setting it, inside the script)

Did you make the animation with a default rig, or did you use a rig with a missing Motor6D, maybe a renamed limb or something?

I’m very certain you can’t play animations on the server. If that doesn’t work, then set the Animation Priority in your animation editor, not in the script. Also don’t add the .CharacterAdded or :WaitForChild() because if they die, it will cause problems.

You can play animations on the server, it’s just more reliable and efficient to do on the Client side since, they replicate and there’s no much delay to it.

okay, I’m gonna try again, play it on the client, see if it works

Oh I didn’t know that. Well it must have something to do with him setting the “anim” variable outside the function.

well, that wouldn’t change anything, since it’s outside the function you can use it anywhere inside the script

Can you show us the path to the animation, where it is located? The script is pretty vague on that, maybe that’s the issue.

Are you making a new animation by using Instance.new()? Try doing that inside the function or putting the animation variable inside the function

https://gyazo.com/2bcfa2e8e58252b679314a33dbc793f5

Yea honestly you shouldn’t be playing animations on the server. The preferred way is to do it on the client, and where the animation is located might have an effect on playing the animation.

So should I use Instance.new(), on the client side?

Yes or just create an already existing one inside the LocalScript and load that

So I’m guessing outside the function it goes like:


local anim = script.Parent:WaitForChild("Animations"):FindFirstChild("DeathBeamAnim")

Then after that do you fire the anim to the server and use it inside the function?

Still does not work, I’m playing it on the client now

Could you show us the script? 30char

wait just a sec, imma try using instance.new