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

Keep on getting an error (attempt to index nil with 'WaitForChild' error?)

Asked by 3 years ago
Edited 3 years ago

I've been trying to script an inventory system for a little bit, but can't seem to get this script working. The error (

Players.NovaGooBoom.Backpack.LocalScript:15: attempt to index nil with 'WaitForChild'

Keeps on popping up in the output channel, my script is

https://pastebin.com/Y4Y4vs0m (can't figure out how to do the formating thing, sorry)

thanks.

0
Sometimes, the script does not always understand what we are doing, try creating a variable for what you are requesting. JailBreaker_13 350 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

You used '.Character' without giving it some time to load in. Try changing line 2 to this:

local Char = Plr.Character
repeat 
    wait()
    Char = Plr.Character
until Char ~= nil
Ad

Answer this question