AnimationTrack not stopping

local ReplicatedStorage = game:GetService('ReplicatedStorage')

local TauntTrack = nil

function TauntAction(Character, Value)
	if TauntTrack == nil then
		return
	end

	if Value == 'Taunting' then
		TauntTrack:Play()
		print('yea')
	end

	if Value == 'NoTaunting' then
		TauntTrack.Looped = false
		TauntTrack:Stop()
		print('no')
	end
end

ReplicatedStorage.Remotes.TauntEvent.OnServerEvent:Connect(function(Player:Player, Value)
	local Character = Player.Character or Player.CharacterAdded:Wait()
	local Humanoid = Character:WaitForChild('Humanoid')
	local Animator = Humanoid:WaitForChild('Animator')
	local Track = Animator:LoadAnimation(ReplicatedStorage.Animations.Player:WaitForChild('Taunt'))
	TauntTrack = Track
	print('yea')
	task.wait(0.1)
	TauntAction(Character, Value)
end)

No error, it works it’s just that the line where it stops the TauntTrack doesn’t stop it

Have you tried using break instead of TauntTrack.Looped = false ?

Doesn’t that only works with loops?

Oh sorry, my bad. I noticed that you said it was not looped so I thought you just had to break it.

How about setting the value to nil when it’s not taunting and then reassign the value when it is? Basically, assign the animation track to nil when not taunting.

That made the solution, Thanks!

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