Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Index error pops up at line 4 how to fix?

Error: 16:23:57.867 - Players.Aeroporia.PlayerScripts.Pickup:11: attempt to index nil with 'WaitForChild'

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local char = player.Character
local stats = char:WaitForChild("Stats")

1 answer

✓ Accepted answer

i just had to put a wait() in the script and

1 comment

1

Instead I would advise using waiforchild in line 3 as well as 4. local char = player:WaitForChild("Character")

This discussion is preserved as it was. New answers, comments, and votes are closed.