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

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

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

2 comments

0

Change PLAYERNAME to your name :/

0

It's not working

1 answer

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.

4 comments

0

Ah but I'm confused as to where I have to put the names in D:

0

You don't have to add names in the script above.

0

Nevermind, I had to switch the player into the name. Thank you, you're a hero!

0

No problem, just copy and paste it into a normal script and it will work..Feel free to accept if it helped.

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