Animations not replicating to server/other clients

I want other player to see animation when I use tool but the animation won’t replicate

I tried playing animation from server side but the animation didn’t played

this is the code that plays animation (LocalScript) under the tool

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local Animations = ReplicatedStorage:WaitForChild("Animations")

local SlapAnimation = Animations:WaitForChild("Slap")

local LocalPlayer = Players.LocalPlayer

local Tool = script.Parent

Tool.Activated:Connect(function()
	local Track = LocalPlayer.Character:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(SlapAnimation)

	Track.Priority = Enum.AnimationPriority.Action
	Track.Looped = false
	
	Track:Play()
end)

The animation is also made by me and uploaded under the group that owns the place

Screen Shot 2564-12-29 at 8.33.48 AM

1 Like

You’re saying your issue :joy:
‘Local Script’ meaning it’ll only appear for the client, inside of the tool I suggest creating a remote event and a serverscript all under the tool, place this code within the serverscript.

script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
  	local Track = plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(SlapAnimation)
    Track:Play()
end)

Make sure to fire the remote event through the local script.

1 Like

Oh, I thought animations will always replicate even if it’s played from localScript, I’ll try that. Thanks for helping!

Local Script means it’ll only replicate it through the client, regardless if it’s animations / anything of that aspect.
Serverscripts will replicate it to every player inside the game. :slight_smile:

1 Like

My animation didn’t played, also there is no error

Tool.Activated:Connect(function()
	if Equipped then
		if not Tool.Enabled or not Equipped or CanSlap then
			return
		end
		
		coroutine.wrap(function()
			local Track = Character:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(SlapAnimation)

			Track.Priority = Enum.AnimationPriority.Action
			Track.Looped = false

			Track:Play()
		end)()
		
		Slapped = {}

		Tool.Enabled = false
		
		CanSlap = true
		
		for Index, Player in ipairs(GloveZone:getPlayers()) do
			SlapPlayer(Player)
		end
		
		wait(2)
		
		CanSlap = false
		
		Tool.Enabled = true
	end
end)

This is my code (Server script)

I suggest creating an instance for animations.


local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://000"
local PlayAnimation = plr.Character.Humanoid:LoadAnimation(Animation)
PlayAnimation:Play()
1 Like

I tried that and it didn’t work too, By the way I’m using player.Character.Humanoid.Animator:LoadAnimation

Animationtracks doesn’t need the server permission to replicate.
See https://developer.roblox.com/en-us/articles/Roblox-Client-Server-Model

yeah, but I tried playing from client and the animation track won’t replicate.

Try again in a real game, not in playtest in Studio.

That shouldn’t matter, regardless from my experience with working with tools that require an animation, I’d do it with a remote event on a server-script to prevent issues like these happening.

I suggest you use my method and create an instance for the animation.

1 Like

Alr let me try play on a real game, if it didn’t work then I will use @saouvs method
Thanks for helping!

1 Like

I used @saouvs method and it worked! (but I didn’t use remote event, I played the animation directly from server instead)
Thanks for helping!!! also I found out that the animation I uploaded priority was set to Core, I reuploaded with priority set to Action
Hope this help other people that had this issue too
:smiley: