Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.