local player = game.Players.LocalPlayer.Humanoid if player then player.Humanoid.Health = 10 end
I've tried to get this to work, but it just won't. Anyone have any advice?
The player does not have a humanoid; for this reason you must instead use the following:
local player = game.Players.LocalPlayer.Character.Humanoid
local player = game.Players.LocalPlayer.Character:findFirstChild("Humanoid") if player then player.Health = 10 else end
local player = game.Players.LocalPlayer.Character:findFirstChild("Humanoid") if player then player.Health = 10 end
The one below will also work you just have to put it into a LocalScript and into StarterGui.
Put it in a LocalScript in StarterGui. LocalScripts can only go in players backpack or PlayerGui (PlayerGui = StarterGui) Scripts can't run LocalPlayer, only LocalScripts.
local player = game.Players.LocalPlayer.Humanoid if player ~= nil then -- ~= means it's the opposite. So if it were to say = nil, that means if it is nil it will work, if it is ~= and Humanoid is nil, it won't work. player.Humanoid.Health = 10 end