Animation works for one player but not another

Hey! My animation works for the owner of the game but not for me. Does anyone have any ideas why?

local tool = script.Parent

local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait() or plr.Character
local humanoid = char:WaitForChild('Humanoid')

print('here')

local anim = humanoid:LoadAnimation(tool:WaitForChild('Anims'):WaitForChild("Animation"))
anim.Priority = Enum.AnimationPriority.Action
print(anim.Priority)

print('yes sir')
	
tool.Activated:Connect(function()
	anim:Play()
	print('Animation')
end)
2 Likes

Is this in a Localscript?

e

1 Like

Yes.
–Minimum character limit

Try making a RemoteEvent, fire it when the tool is activated and try running the animation in the server by listening to the RemoteEvent signal.

Oh, and humanoid:LoadAnimation is deprecated, replace it with humanoid:WaitForChild(“Animator”):LoadAnimation(etc)

Loading animations onto the Humanoid is deprecated.
You’ll have to load the animations onto the Animator (Which is parented to the Humanoid) for it to replicate to other clients.

1 Like

Hey! I tried this but it didn’t work. I’ll send my code so you can check for any errors.

tool.Activated:Connect(function()
	game.ReplicatedStorage.RemoteEvent:FireServer()
end)
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
	local char = plr.Character
	local humanoid = char.Humanoid
	
	local anim = humanoid.Animator:LoadAnimation(game.ReplicatedStorage.Animation)
	anim:Play()
	print('played')
end)

Your previous script should have worked, the only problem is that you werent loading the animation to the animator, which is why other players couldnt see the animation.
The remote event is pointless.

I should also mention, the owner of the game must be the person who uploads the animation.
If you upload an animation, but the owner of the game using it is your friend, the animation wont work.

1 Like

Well, as @Chark_Proto said,

I had no idea that Animator:LoadAnimation() and Humanoid:LoadAnimation() had that difference. There’s no problem on playing animations in the client as long as you use this new method. The RemoteEvent is pointless now, better follow @Chark_Proto’s instructions. (Also, thanks for the explanation EZQP3, I learnt something new today)

1 Like

Also, if the Animator is created on the client, animations will not replicate, the Animator has to be server created. Or at least that is what I read in the api docs. Not sure if they have changed that or not.

Humanoid:LoadAnimation's still works (for the sake of backwards compatibility) it’s just deprecated.

1 Like

Animations need to be uploaded by the experience’s creator in order for the animation to work.

1 Like

That’s true. But he must add more “event listeners” called remote events, i like to call them “event listeners” because it feels more fitting

Or maybe the animation is pending through roblox’s crazy moderation

Who made the animation? Where are you testing (studio or in-game)?

I guess this means you’re in a team create with someone.
If the animation was made by the owner and uploaded to their inventory and you’re in a tean create with them then you wont see the animation.
Same case with you, if you make an animation, upload it for yourself and play it then the owner wont see the animation but only you.

The only way I know how to fix this is by uploading the animations to a group that both of you are in and the game itself is a game made by that group.

I dont know if you or the owner have enough to make a group (100R) but if you do it should fix the animations issue.

If you both cant make a group I guess your only solution is to deal with it :man_shrugging: because in-game everyone would see the animation.

1 Like

That’s true. But he must add more “event listeners” called remote events

Not necessary at all, character animations should be loaded and played on the client.
https://developer.roblox.com/en-us/api-reference/function/Animator/LoadAnimation

1 Like