Animation only playing on server

Hi, i made two buttons which when clicked, fires a remoteevent(different for each button). And so, when the remoteevent is fired, it’ll play a tween and a color.
watch here: https://gyazo.com/79428b844cddb5132de1fe62cf91733f
the problem is, the idle animation isn’t playing on client side
at the very end, you could see that the idle animation is only playing on server side
does anyone why does this happen?
script if needed
local script if needed:

script.Parent.MouseButton1Click:Connect(function()
	local remoteEvent = game.ReplicatedStorage.angry
	remoteEvent:FireServer()
end)

serverscript:

local remoteEventA = game.ReplicatedStorage.angry
local remoteEventB = game.ReplicatedStorage.idle
--> angry animation
remoteEventA.OnServerEvent:Connect(function(player)
	local kBot = workspace:WaitForChild(player.Name.."'s K-BOT")

	local animator = kBot:WaitForChild("Humanoid").Animator
	local animations = {
		['Hold'] = kBot.animation.Hold,
		['Idle'] = kBot.animation.Idle,
		['Angry'] = kBot.animation.Angry
	}
	
	local ts = game.TweenService
	local tween = ts:Create(kBot.face, TweenInfo.new(1), {Color = Color3.new(1, 0, 0)})
	tween:Play()
	
	local loadAnimation = animator:LoadAnimation(animations['Angry'])
	loadAnimation.Priority = Enum.AnimationPriority.Action
	loadAnimation.Looped = true
	loadAnimation:Play()
end)
--idle animation
remoteEventB.OnServerEvent:Connect(function(player)
	local kBot = workspace:WaitForChild(player.Name.."'s K-BOT")

	local animator = kBot:WaitForChild("Humanoid").Animator
	local animations = {
		['Hold'] = kBot.animation.Hold,
		['Idle'] = kBot.animation.Idle,
		['Angry'] = kBot.animation.Angry
	}

	local ts = game.TweenService
	local tween = ts:Create(kBot.face, TweenInfo.new(1), {Color = Color3.new(0.0156863, 0.686275, 0.92549)})
	tween:Play()

	local loadAnimation = animator:LoadAnimation(animations['Idle'])
	loadAnimation.Priority = Enum.AnimationPriority.Action
	loadAnimation.Looped = true
	loadAnimation:Play()
end)

For character animations to replicate they have to be loaded and played on the client. This is true only when the character has a humanoid object. If it doesn’t have a humanoid object then you’ll need to signal the animation to play on each client.

1 Like

my character has a humanoid and i want the animation to be seen by other players, how would i do that ?

Since this is an NPC it should be fine to play this from the server. I think you might just be having a problem with one animation overtaking the other. They have the same priority level and are never stopped.

1 Like