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
local Gun = script.Parent
local Animations = Gun:FindFirstChild("Animations")


Gun.Equipped:Connect(function(part)
    print("equip")
    local humanoid = Gun.Parent:FindFirstChild("Humanoid")
    print(humanoid.Parent)
    local Hold = humanoid:LoadAnimation(Animations.Hold)
    Hold:Play()
end)

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