PlayerScripts.HealthUp:3: attempt to index nil with 'WaitForChild' how to fix that ?
Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).
Hi I have a problem, please help me.
01 | local Power = game.Players.LocalPlayer:WaitForChild( "leaderstats" ):WaitForChild( "Power" ) |
02 | local Char = game.Players.LocalPlayer.Character |
03 | Char:WaitForChild( "Humanoid" ) |
05 | local function Set(Regen) |
07 | game.ReplicatedStorage.SetHealth:FireServer(Char, math.floor( 100 + Power.Value/ 10 ), math.floor( 100 + Power.Value/ 10 )) |
09 | game.ReplicatedStorage.SetHealth:FireServer(Char, nil , math.floor( 100 + Power.Value/ 10 )) |
14 | Power.Changed:Connect( function () |
18 | Char.Humanoid.Died:Connect( function () |
19 | game.Players.LocalPlayer.CharacterAdded:Wait() |
OUTPUT:
PlayerScripts.HealthUp:3: attempt to index nil with 'WaitForChild'