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

How to set extra health?

Asked by 3 years ago

So, I'm making a game with specific player classes and to do that i use teams, since when they spawn they're gonna be assigned random classes.

Anyways i put this script in StarterPlayerScripts, so that if it'd work it would be easier for me to check the player's team

local Player = script.Parent
local humanoid = Player.Character.Humanoid 

humanoid.Health = humanoid.Health = 200
humanoid.MaxHealth = humanoid.MaxHealth = 200

But when i run the script it just doesn't set the player's maxhealth, and gives no errors in the output window.

Help?

0
Accept @Gingerely's answer if it is correct please, so we know this question has been answered. killerbrenden 1537 — 3y

1 answer

Log in to vote
3
Answered by
Gingerely 245 Moderation Voter
3 years ago

The easiest way to do this is to put the script in StarterCharacter scripts and doing this

local Char = script.Parent
Char.Humanoid.MaxHealth = 200
Char.Humanoid.Health = 200

You also set the health the wrong way, humanoid.maxHealth = humanoid.MaxHealth = 200

0
I tried your solution and it works, altough now I need a way to find the Player's team starting from it's character. Thanks anyways! TheOnlineItalian213 99 — 3y
3
Could you accept the answer? Gingerely 245 — 3y
2
Click the checkmark next to my answer. Gingerely 245 — 3y
Ad

Answer this question