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

Someone help me with this humanoid health problem? [BEGINNER]

Asked by 6 years ago

I want to give a certain amount of health to a player when they join a server. I'm new to scripting but this should be a simple one; but it's not working?!

This is all I've got right now:

game.workspace.PLAYERNAME.Humanoid.MaxHealth= 130

I feel as if this should work but it's not even giving me the health! Please somebody help me out ):

Thank You

0
Change PLAYERNAME to your name :/ mixgingengerina10 223 — 6y
0
It's not working ScriptingHelper1038 -13 — 6y

1 answer

Log in to vote
0
Answered by
iSvenDerp 233 Moderation Voter
6 years ago

Hi, I'll explain the correct script to you.

game.Players.PlayerAdded:connect(function(player) --Function to see when the player joins the game
    player.CharacterAdded:connect(function(character) --loading the character, this lets us access the humanoid where the health is at.
        local hum = character:WaitForChild("Humanoid")
        hum.MaxHealth = 130
        hum.Health = 130         
    end)
end)

Let me know if you have any questions! Here you go:) Just put this in workspace, accept if it helped. This changes to health when a player joins the game.

0
Ah but I'm confused as to where I have to put the names in D: ScriptingHelper1038 -13 — 6y
0
You don't have to add names in the script above. mixgingengerina10 223 — 6y
0
Nevermind, I had to switch the player into the name. Thank you, you're a hero! ScriptingHelper1038 -13 — 6y
0
No problem, just copy and paste it into a normal script and it will work..Feel free to accept if it helped. iSvenDerp 233 — 6y
Ad

Answer this question