How to play animations in server script?

Hello, I am trying to play a animation while using ServerScript.I tried a few things but they are not working and I don’t what I am doing wrong or well, I don’t know what I am doing true
like I don’t know if I put animation to right place or is script true or if they are both true then should I add something else?
by the way I am trying achive all players can see each other’s animations
and I am not sure if using OnServerEvent is a wise choice? I just thought if player is the one who will trigger it so I should put it there??? Idk
this is the script I wrote so far

local players = game:GetService("Players")
local toolConfig = require(game.ServerStorage:WaitForChild("MontalayaciAhmetUSta"):WaitForChild("ToolConfig"))
local remotes = replicatedStorage:FindFirstChild("Remotes")
local anim = script:FindFirstChild("Animation")

if not player.Character then return end
	local animtrack = player.Character:WaitForChild("Humanoid"):LoadAnimation(anim)

and here is the screenShot of FireServer()

I am open to every opinion


Humanoid:LoadAnimation() doesnt work anymore, use Humanoid.Animator:LoadAnimation()

Thanks! I change it to player.Character:WaitForChild(“Humanoid”):FindFirstChild(“Animator”):LoadAnimation(anim)
but still not working

Do you own the animation? What is the animation priority?

I have the animation since I am the one who made it

Well first thing, may I ask why you’re doing this on server? Playing animations on client will replicate to server, doing it on server just wastes performance.

I didn’t know that! so even I put it to client, other players still can see each other’s animations when they activate the tool? and I thought since I am using OnServerEvent it there wouldn’t be any difference.

Any animation played on client will be seen by other players too.

1 Like

That is really nice to know! but I have a question about that I want to add script to tools and all Tools are in serverStorage and I can’t parent scripts to tools if I won’t use server?