I have a server script that plays an animation throught an remote event, it works correctly fine on the client but on the server not

aim.OnServerEvent:Connect(function(plr, aiming)
	local aimanim = game.Workspace[plr.Name].Humanoid:LoadAnimation(script.Parent.aim)
	local aimvalue = script.Parent.Aiming

	if aiming == true then
		aimvalue.Value = true
		aimanim:Stop()
		aimanim:Play()
	else
		-- it wont stop on the server
		aimvalue.Value = false
		aimanim:Play()
		aimanim:Stop()
	end
	tool.Unequipped:Connect(function()
		aimvalue.Value = false
		aimanim:Play()
		aimanim:Stop()
	end)
end)

2 comments

0

Animations should only be handled on the client side. As far as my experience tells me.

1

Okay thank you it worked!