Animation problem

ReplicatedStorage.Animation.OnServerEvent:Connect(function(Player,Type)
	local humanoid = Player.Character.Humanoid
	local animator = humanoid:FindFirstChildOfClass("Animator")
	local IdleTrack = animator:LoadAnimation(script.Parent.Idle)
	if Type == "Idle" then
		IdleTrack:Play()
		return IdleTrack
	elseif Type == "Destroy" then
		IdleTrack:Stop() -- here is problem
		return 0
	end
end)

The problem is when i try to stop track does not stop completely.some parts of the player are still playing animation

1 Like

Each time the ServerEvent is fired, you’re creating a new animation track. Create the track outside of the function and access it when the function is called.

1 Like