Why is the animation not replicated on the server? [Solved]

Hello, my name is Axel, I am trying to solve a problem that I have been trying to solve for days, but I did not find, I even asked for help in the forum but I did not find a satisfactory solution, I am trying to get the animations to replicate correctly on the server but They are still seen, they do not reproduce as they should, only the local player can see it and when I die I get an animation error that refers to line 8 of “AnimationTrack”, I want to clarify that I am not an expert in this and a sample of the problem is the following:

As I said before, I have not been able to solve the problem, all this is being executed from a local script that is inside a tool in StarterPack, this is the code:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local tool = script.Parent
local Animator = Humanoid:WaitForChild("Animator")
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://6350259222"
local AnimationTrack = Animator:LoadAnimation(Anim)
local Anim2 = Instance.new("Animation")
Anim2.AnimationId = "rbxassetid://6364334315"
local AnimationTrack2 = Animator:LoadAnimation(Anim2)
local RS = game:GetService("ReplicatedStorage")
local Strength = RS.RemoteEvents.Strength
local db = false

--Animation
tool.Equipped:Connect(function()
	AnimationTrack:Play()
	AnimationTrack.Priority = Enum.AnimationPriority.Idle
	Humanoid.UseJumpPower = true
	Humanoid.WalkSpeed = 0
	Humanoid.JumpPower = 0
end)
tool.Activated:Connect(function()
	if db == false then
	   db = true
	   AnimationTrack2:Play()
	   AnimationTrack2.Priority = Enum.AnimationPriority.Action
	   Strength:FireServer()
	   wait(2)
	   db = false
	end
end)
tool.Unequipped:Connect(function()
	AnimationTrack:Stop()
	AnimationTrack2:Stop()
	Humanoid.UseJumpPower = true
	Humanoid.WalkSpeed = 16
	Humanoid.JumpPower = 50
end)

If I am missing something important, you can let me know and I would appreciate the help, thanks!

Make sure the when animation starts it fires a remote event

I am not using a remote event, everything is being executed from a local script, read the article

Hi, I am having the same problem. It gives me an error saying " clampKeyframeTime called but animation asset isn’t loaded in animationTrack." Everything is working fine earlier and I didn’t even changed anything.

If its executing by a local script, make sure to add a remote event, which fires whenever a its is called!
Let me show you an example;
(LocalScript)

local hi = "Hello! "..game.Players.LocalPlayer.Name
game.ReplicatedStorage.EVENT:FireServer(hi)

(ServerScript)

-- Fires whenever EVENT is called
game.ReplicatedStorage.EVENT.OnServerEvent:Connect(function(player,hi) 
print(hi) -- Will print "Hello! "..{user} and will be seen for everyone
end)

…this is the game, reply back if you still need help!

I understand you, but the problem is that the animation works perfectly on the client, but it does not replicate well on the server, apart from the fact that when I die I get an error and the animations stop working.

I just started experiencing this exact issue a couple of minutes ago. Possibly related to a Roblox update? No changes were made on my end.

You need to be using Humanoid:LoadAnimation() instead of Animator:LoadAnimation().

yeah i also just got this error. believe updates broke it. please report it!

I’ve done so here.

I am using Animator: LoadAnimation because Humanoid: LoadAnimation is deprecated.

1 Like

You are correct in stating that you do not need remote events to allow the server to see the animations. Animations should automatically replicate to the server. I have also started experiencing this problem as of recently.

I never knew that! Apologies, is this script a LocalScript?

you probaly need. a server script for the animation when the tool is equipped like this

local animation = script.Parent.Animation
local tool = script.Parent

tool.Equipped:Connect(function()
    Animation:Play()
end

Just an example.

Yes, everything seems to work fine on the client, the problem is that the animations are not replicated correctly on the server, apart from that when I die I get an error.

u cant use local script to interact with the server unless u are using a remote event

Yeah, that’s why I am asking if it’s a LocalScript, because you can only call FireServer on a LocalScript.

that looks like a server script to me

It is a LocalScript, as he stated before:

i would say no. thats why i said it looks like a server script