Pretty much, I equip the gun, the animation plays and stays, but when I dequip the weapon, the animation still stays even though I've stopped it.

Tool = script.Parent
local player = game.Players.LocalPlayer
repeat wait() until player.Character ~= nil
local hum = player.Character:WaitForChild("Humanoid")
local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=511269087"
local animTrack = hum:LoadAnimation(animation) -- change Humanoid to the target's HumanoidanimTrack:Play()

Tool.Equipped:connect(function(mouse)
	

	
	animTrack:Play()
	
	
	animTrack.KeyframeReached:connect(function(Hold)
			animTrack:AdjustSpeed(0)
		end)
end)
 

Tool.UnEquipped:connect(function()
	animTrack:AdjustSpeed(1)
	animTrack:Stop()
end)

Video of the problem

2 comments

1

Roblox is case sensitive. It should be Unequipped and not UnEquipped

0

God, I'm an idiot. Thanks a lot.