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

So I Am Trying To Make My Health Scale With My Endurance. Anyone Know How To Do That?

Asked by 4 years ago
Edited 4 years ago

ServerScriptService.Health:1: attempt to index nil with 'WaitForChild' So This Is The Error I Been Getting And This Is My Script

local maxhp = game.Players.LocalPlayer:WaitForChild("Humanoid").MaxHealth

local Endurance = game.Players.LocalPlayer:WaitForChild("leaderstats").Endurance

while wait() do

    maxhp = 100 + (Endurance.Value)

end

This Is A Normal Script Too, And Its In ServerScriptStorage

2 answers

Log in to vote
0
Answered by 4 years ago

You can't use LocalPlayer from a server script, you have to do it from a local script.

Ad
Log in to vote
0
Answered by
Ascarson4 138
4 years ago
Edited 4 years ago

Like e6_4KOkGsp said, you can't use LocalPlayer from a server script. What you can do is, make it a localscript, then use a remote event to tell the server to add the value of endurance to the player's health.

Answer this question