You’re trying to get the Player’s name in the workspace? I think it’s a simple fix just by doing:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
if Player and Player.TeamColor == BrickColor.new("Mint") then
Character.Humanoid.MaxHealth = 250
Character.Humanoid.Health = 250
wait(.1)
end
Another thing to note is that just changing the Health alone won’t work, so you need to change the MaxHealth first then Health next
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player) -- This function is called everytime a player joins the game
player:GetPropertyChangedSignal("TeamColor"):Connect(function()
-- This function is called everytime the "TeamColor" property of the player is changed
if player.TeamColor == BrickColor.new("Mint") then
local character = player.Character or player.CharacterAdded:Wait()
character.Humanoid.MaxHealth = 250
character.Humanoid.Health = 250
end
end)
end)
--ServerScriptService (It needs to be a regular script, not a Local)
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
print(Player.TeamColor)
if Player.TeamColor == BrickColor.new("Mint") then
Character.Humanoid.MaxHealth = 250
Character.Humanoid.Health = 250
end
end)
end)