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

Animation for Sword error. Can somebody explain me what's the Problem?

Asked by 3 years ago
Edited 3 years ago

Hi there! I tried to make an animated tool with this LocalScript:

local player = game:GetService("Players").LocalPlayer
local animation = script.Parent:FindFirstChild("Animation")
local swingAnimation = player.character.Humanoid:LoadAnimation(animation)

local canSwing = true

local debounce = 1

script.Parent.Activated:Connect(function()
    if canSwing then
        canSwing = false
        swingAnimation:Play()
        wait(debounce)
        canSwing = true
    end
end)

Sadly it didn't work. I got this error: Players.Mimas18Hun.Backpack.Tool.LocalScript:3: attempt to index nil with 'Humanoid' - Client - LocalScript:3

Can somebody explain me, what's the problem?

0
It's "Character" with a capital "C" Spjureeedd 385 — 3y

Answer this question