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

The code is trying to call on WaitForChild rather than Humanoid, how do I fix this?

Asked by 3 years ago

This is the error I'm getting and it brings me to line 3

WaitforChild is not a valid member of Model "Workspace.AlphaFlame5"

01local Player = game:GetService("Players").LocalPlayer
02local Character = Player.Character or Player.CharacterAdded:wait()
03local Humanoid = Character:WaitforChild("Humanoid")
04 
05local PlrStats = Player:WaitForChild("PlrStats")
06 
07local Stamina = PlrStats:WaitForChild("Stamina")
08local MaxStamina = PlrStats:WaitForChild("MaxStamina")
09local Level = PlrStats:WaitForChild("Level")
10local Exp = PlrStats:WaitForChild("EXP")
11 
12local PlrInfo = script.Parent
13local HealthBar = PlrInfo.HealthBar
14local StaminaBar = PlrInfo.StaminaBar
15 
View all 30 lines...

2 answers

Log in to vote
1
Answered by 3 years ago

Lua is case sensitive, its just erroring because your wrote WaitforChild instead of WaitForChild. :)

01local Player = game:GetService("Players").LocalPlayer
02local Character = Player.Character or Player.CharacterAdded:wait()
03local Humanoid = Character:WaitForChild("Humanoid")
04 
05local PlrStats = Player:WaitForChild("PlrStats")
06 
07local Stamina = PlrStats:WaitForChild("Stamina")
08local MaxStamina = PlrStats:WaitForChild("MaxStamina")
09local Level = PlrStats:WaitForChild("Level")
10local Exp = PlrStats:WaitForChild("EXP")
11 
12local PlrInfo = script.Parent
13local HealthBar = PlrInfo.HealthBar
14local StaminaBar = PlrInfo.StaminaBar
15 
View all 30 lines...
0
Thank you so much, I have a tendency to look over small details like that often. AlphaFlame5 -1 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Lua is case sensitive and you entered WaitforChild() instead of WaitForChild() on line 3.

Answer this question