Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make it so that when i equip a tool, a animation plays?

Asked by 4 years ago

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?

01local FightTool = game.StarterPack.Fight
02 
03local function onEquip()
04 
05    local thePlayer = game.Players.LocalPlayer
06    local animation = game.StarterPack.Fight.LocalScript.Animation.AnimationId
07    local humanoid = thePlayer.Character.Humanoid
08 
09 
10    local animationn = Instance.new("Animation")
11    animationn.AnimationId = animation
12 
13 
14    local PlayAnimation = humanoid:LoadAnimation(animationn)
15    PlayAnimation:Play()
16 
17end
18 
19FightTool.Equipped:Connect(onEquip)
0
Is your animation priority Action? pokemine1o9 44 — 4y
0
Oh wait, you're getting the tool from the starter pack, not the players backpack. Try getting it from the players backpack instead pokemine1o9 44 — 4y
0
I tried both and it did not work oof fireyfoxninja21 9 — 4y

Answer this question