Animation with tool not replicating tool movement in server

Hello, i’m working on a sword and i made some animations for it and when i play the animation the body movement replicates on server but not the sword movement and i don’t know why.

Issue video:

I searched in dev forum but i don’t found any topic with my issue.

If you need additional information about the problem let me know

Is the animation played through a Local Script?

The server cannot replicate the animation if it is played through the client, unless you use a RemoteEvent.

All need to be in Server Scripts (instead of the script that detects if the button was clicked)

So, tool animations need to be played in server? Because in roblox default “animate” script all animations are played locally

Isn’t about the animation, I think the problem is another thing, like a weld

But if the sword has a AnimationController isntead of Humanoid, it need to be a ServerScript

Yes. The animations needs to be played on the server else it won’t replicate to others.
I however couldn’t tell why Roblox’s Animate script is local, maybe because the animations are universal or something.

1 Like

The animations of Humanoid can be played in LocalScript, but the animations of AnimationController can’t

1 Like

My animation is from a humanoid, I don’t even know what’s an animation controller, I also tried to play the animation on server, it doesn’t worked

Can you show me the server script?

I made it a remote function because i need the length of the animation in my local script

RemoteFunction.OnServerInvoke = function(Client, Animation, Humanoid)
	
	local Track = Humanoid:LoadAnimation(Animation)
	Track:Play()

	return Track
end

Why not use a RemoteEvent?

Pretty sure you can also get the length of the animationTrack.

I tried using remote event before using remote function, with remote event output prints an error because the track is a variable assigned in server, so i made the remote event a remote function and returned the track variable to client.

But i think the solution isn’t playing the animation in server, as rtvr said, if the animation it’s from an humanoid i can play it in client

I’m curious about this error with the RemoteFunction, but I think I figured it out.
You are trying to tell the server to play an animation that is stored locally. Maybe try this, by creating a new Animation by the server and giving it the Id through a RemoteEvent.

Local

RemoteEvent:FireServer(AnimationId,Humanoid)

Server

RemoteEvent.OnServerEvent:Connect(function(player,animationId,Humanoid)
    local animation = Instance.new("Animation", Humanoid.Parent)
    animation.AnimationId = "rbxassetid://"..animationId
	local Track = Humanoid:LoadAnimation(animation)
	Track:Play()
end

In local script in sent the animation instance, but the error i got from remote event it’s because:

You can simply keep the first Animation in the Local Script and use in the LocalScript the Track.Length function.

https://developer.roblox.com/en-us/api-reference/property/AnimationTrack/Length

Actually “AttackAnimation” it’s an animation track but i went back with my old script, i still have the first issue, the tool movement doesn’t replicate in server, just character movement

Oh you meant the tool? My bad,

If the tool doesn’t move, you must animate the tool if you didn’t.
You can do this by adding a dummy, give him the same tool as the players in his character model and if you move his arm it should work.

I’m not an animator, so I’m not really advanced on this subject, you could try looking up on YouTube.

Please watch the topic’s video, the sword replicates the movement for the player who’s holding the sword but not to other players

To other players just the body moves