I been trying to make it so that when a player equips a tool, a animation plays.

This is what if have so far, when I test it, nothing happens. Can anybody help figure what went wrong and why the animation wont play when the tool is equipped?

local FightTool = game.StarterPack.Fight

local function onEquip()
	
	local thePlayer = game.Players.LocalPlayer
	local animation = game.StarterPack.Fight.LocalScript.Animation.AnimationId
	local humanoid = thePlayer.Character.Humanoid
	
	
	local animationn = Instance.new("Animation")
	animationn.AnimationId = animation
	
	
	local PlayAnimation = humanoid:LoadAnimation(animationn)
	PlayAnimation:Play()
	
end

FightTool.Equipped:Connect(onEquip)




3 comments

0

Is your animation priority Action?

0

Oh wait, you're getting the tool from the starter pack, not the players backpack. Try getting it from the players backpack instead

0

I tried both and it did not work oof