Hi! I'm trying to make an animation script for my sword, so that it may have two slash animations, I get the error in the title when I load the game, can anyone help?
By the way, I'm using a LocalScript.
game.Players.PlayerAdded:connect(function(player)
humanoid = player.Character:WaitForChild("Humanoid")
end)
wait(5)
local slashType = false
slashA = humanoid:LoadAnimation(script.Parent.Slash)
slashB = humanoid:LoadAnimation(script.Parent.SlashB)
if slashType == false then
script.Parent.Activated:connect(function()
slashA:Play()
slashType = true
end)
end
if slashType == true then
slashB:Play()
slashType = false
end
script.Parent.Unequipped:connect(function()
slashA:Stop()
slashB:Stop()
end)

2 comments
I get an error saying, attempted to index nil with "WaitForChild", can you help?
Let me edit the answer.