Attempt to index nil with 'Character' Error?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I keep getting this error somehow, attempt to index nil with character, need help as I’m new and getting into scripting, thanks.

  2. What is the issue?
    Error on the line ‘for i,v in pairs(plr.Character:WaitForChild(“Right Arm”):GetChildren()) do’

  3. What solutions have you tried so far?
    I tried solving it and couldn’t find a solution.

Thanks for any help provided.

Why do you need to get the character if hit.Parent is confirmed to be the player?

this error may cause because the player might have an accessory and that accessory will touch the part so hit.Parent may be the accessory you need to do this:

local Hump = hit.Parent:FindFirstChild("HumanoidRootPart")  or hit.Parent.Parent:FindFirstChild("HumanoidRootPart") or hit.Parent.Parent.Parent:FindFirstChild("HumanoidRootPart")
local character = hump.Parent
local player = game.Players:GetPlayerFromCharacter(character)

this will guarantee that you will find the character correctly

1 Like

I have fixed it by tweaking this thanks!

1 Like