i want to fix my blocking script.
error is
Players.kalersmot123.Backpack.Katana.Block:3: attempt to index nil with ‘WaitForChild’
here is a script:
local uis = game:GetService("UserInputService")
local hum = script.Parent.Parent.Parent:WaitForChild("Humanoid")
local walkspeed = 16
local blockingWalkspeed = walkspeed / 2
uis.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.F then
hum.WalkSpeed = blockingWalkspeed
local animation = script.Parent.Animations.Block
playAnimation = hum:LoadAnimation(animation)
playAnimation:Play()
end
end)
uis.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.F then
hum.WalkSpeed = walkspeed
playAnimation:Stop()
end
end)