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

attempt to index nil with 'Humanoid' error using alvinblox tutorials?

Asked by
xxaxxaz 42
4 years ago
Edited 4 years ago

I was following alvinblox tutorials and this error came up: attempt to index nil with 'Humanoid' can anybody help me?

01local serverStorage = game:GetService("ServerStorage")
02local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerSave3")
03 
04game.Players.PlayerAdded:Connect(function(player)
05 
06    local leaderstats = Instance.new("Folder")
07    leaderstats.Name = "leaderstats"
08    leaderstats.Parent = player
09 
10    local strength = Instance.new("NumberValue")
11    strength.Name = "Strength"
12    strength.Parent = leaderstats
13 
14    local rebirths = Instance.new("IntValue")
15    rebirths.Name = "Rebirths"
View all 64 lines...
0
line 41 is error xxaxxaz 42 — 4y

2 answers

Log in to vote
0
Answered by
MattVSNNL 620 Moderation Voter
4 years ago

You haven't put character at CharacterAppearenceLoaded, Try this

01local serverStorage = game:GetService("ServerStorage")
02local DataStore = game:GetService("DataStoreService"):GetDataStore("PlayerSave3")
03 
04game.Players.PlayerAdded:Connect(function(player)
05 
06    local leaderstats = Instance.new("Folder")
07    leaderstats.Name = "leaderstats"
08    leaderstats.Parent = player
09 
10    local strength = Instance.new("NumberValue")
11    strength.Name = "Strength"
12    strength.Parent = leaderstats
13 
14    local rebirths = Instance.new("IntValue")
15    rebirths.Name = "Rebirths"
View all 64 lines...
0
thanks for trying but if you has not seen my comment I figured it out but this is basicly the same thing so I will accept answer because it is true. xxaxxaz 42 — 4y
Ad
Log in to vote
0
Answered by
xxaxxaz 42
4 years ago

nvm I realized what I did do

1player.CharacterAppearanceLoaded:Connect(function()

what I need to do

1player.CharacterAppearanceLoaded:Connect(function(character)

I needed to put in word character

0
oh and I allso realized that I forgot to do strength.Value instead of strength xxaxxaz 42 — 4y

Answer this question