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

How do I get script to find the animation inside a folder?

Asked by 4 years ago
01local Gun = script.Parent
02local Animations = Gun:FindFirstChild("Animations")
03 
04 
05Gun.Equipped:Connect(function(part)
06    print("equip")
07    local humanoid = Gun.Parent:FindFirstChild("Humanoid")
08    print(humanoid.Parent)
09    local Hold = humanoid:LoadAnimation(Animations.Hold)
10    Hold:Play()
11end)

This gives the error 15:09:40.441 - Players.AthenaThorn.Backpack.Gun.GunScript:9: attempt to index nil with 'Hold'

But there's an animation called Hold in Animations folder.

1 answer

Log in to vote
0
Answered by 4 years ago

local Hold = script.parent.Hold

0
just put the animation in the script themaxogamer 58 — 4y
Ad

Answer this question