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

Index error pops up at line 4 how to fix?

Asked by 3 years ago

This question has been solved by the original poster.

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

Log in to vote
1
Answered by 3 years ago

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

1
Instead I would advise using waiforchild in line 3 as well as 4. local char = player:WaitForChild("Character") msuperson24 69 — 3y
Ad

Answer this question