ServerScriptService.Health:1: attempt to index nil with 'WaitForChild' So This Is The Error I Been Getting And This Is My Script
1 | local maxhp = game.Players.LocalPlayer:WaitForChild( "Humanoid" ).MaxHealth |
2 |
3 | local Endurance = game.Players.LocalPlayer:WaitForChild( "leaderstats" ).Endurance |
4 |
5 | while wait() do |
6 |
7 | maxhp = 100 + (Endurance.Value) |
8 |
9 | end |
This Is A Normal Script Too, And Its In ServerScriptStorage
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.