Hi does anybody know a script that increases the players health and that i can modify so i can set there health to what i wabt
1 Like
You can modify the MaxHealth
and Health
property of a Humanoid, through a ServerScript.
Here’s an example Script, where we give extra health to a User with a specific name:
local Players = game:GetService(“Players”)
Players.PlayerAdded:Connect(function(Plr)
Plr.CharacterAdded:Connect(function(char)
if char.Name == “Diam0ndzOnYT” then
local humanoid = char:WaitForChild(“Humanoid”)
humanoid.MaxHealth = humanoid.MaxHealth + 100 -- Adds extra health to the specific Player
humanoid.Health = humanoid.MaxHealth -- Changes current health to match the MaxHealth
end
end)
end)
Edit: Sorry if I misunderstood your question, but if you want this Script to apply to all Players, you can simply remove these lines:
i want to give everybody more health when they join the game
local health = 200 --set this to the health you need
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").MaxHealth = health
character:WaitForChild("Humanoid").Health = health
end)
end)
thank you !!!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.