Animations break when viewed from another client

I have a script that changes a players animation IDs, they apply fine on the players client but when viewed by another player it appears broken:

My Client:

Their Client:

Code changing IDs:

local function replaceAnimations(folder)
	for _, anim in folder:GetChildren() do
		local charAnim = CharAnimations:FindFirstChild(anim.Name)
			
		if charAnim then
			charAnim.AnimationId = anim.AnimationId
		end
	end
end
	
if sheathe == true then
	replaceAnimations(Defaults)
else
	replaceAnimations(Greatsword)
end

Code applying Animations when ID changes:

local animChange = anim:GetPropertyChangedSignal("AnimationId"):Connect(function()

	animTracks[anim.Name] = animator:LoadAnimation(anim)
	animChanged:Fire()
			
	for _, playingAnim in hum:GetPlayingAnimationTracks() do
			
		if playingAnim.Name == "Sheathe" then
			playingAnim:Stop(.5)
		end
			
		if playingAnim.Name == anim.Name then
			playingAnim:Stop()
			animTracks[anim.Name]:Play()
		end
	end
			
end)
1 Like

Roblox will listen to clients when it comes to replicating animations, but will not listen to property changes. So I think it’s telling other clients to play the animation, but they don’t reload the tracks when you change the ID because the ID change doesn’t replicate (you could print the AnimationID on the other client and verify)

So to solve this you would want to avoid changing the AnimationID and create new tracks for each animation in your game. Alternatively, you could try setting the AnimationID on the server? I haven’t tried that though

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.