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?

1 comment

0

It's "Character" with a capital "C"