Animations for tool won't stop?

title is self-explanatory, here is my script (server)

local Tool = script.Parent

local equipped = false

Tool.Equipped:Connect(function()
	local Hum = Tool.Parent:WaitForChild("Humanoid")
	
	local Equip = Hum:LoadAnimation(script.Parent.Equip)
	local Idle = Hum:LoadAnimation(script.Parent.Idle)
	
	Equip:Play()
	Equip.Stopped:Wait()
	
	Idle:Play()
end)

Tool.Unequipped:Connect(function()
	local Hum = Tool.Parent:WaitForChild("Humanoid")

	local Equip = Hum:LoadAnimation(script.Parent.Equip)
	local Idle = Hum:LoadAnimation(script.Parent.Idle)

	Equip:Stop()
	Idle:Stop()
end)

This should be in a local script, for one.

Secondly, you’re loading the animation twice which is creating two instances of the AnimationTrack. In a local script:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

-- anims
local Equip = Humanoid:LoadAnimation() -- equip anim path
local Idle = Humanoid:LoadAnimation() -- idle anim path

local Tool = -- tool path

Tool.Equipped:Connect(function()
	Equip:Play()
	Equip.Stopped:Wait()
	Idle:Play()
end)

Tool.Unequipped:Connect(function()
	Equip:Stop()
	Idle:Stop()
end)

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