Contouri
|
  |
| Joined: 07 Oct 2011 |
| Total Posts: 2792 |
|
|
| 10 Jul 2015 04:24 AM |
local teams = {red = BrickColor.Red(), blue = BrickColor.Blue()}
local function GetTeamInfo(TeamColor) local Count = 0 local Players = {} for Index, Player in next, game:GetService("Players"):GetPlayers() do local Color = Player.TeamColor if Color == TeamColor then Count = Count + 1 table.insert(Players, Player) end end return {count = Count, players = Players} end
function applyHealth(greater, less) for _, player in pairs(less.players) do if player.Character:FindFirstChild("Humanoid") then player.Character.Humanoid.MaxHealth = 100 + ((greater.count - less.count) * 5) end end end
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) local redInfo = GetTeamInfo(teams.red) local blueInfo = GetTeamInfo(teams.blue) if redInfo.count > blueInfo.count then applyHealth(redInfo, blueInfo) elseif blueInfo.count > redInfo.count then applyHealth(blueInfo, redInfo) else for _, player in pairs(game.Players:GetPlayers()) do if player.Character:FindFirstChild("Humanoid") then player.Character.Humanoid.MaxHealth = 100 end end end end) end) |
|
|
| Report Abuse |
|
| |
|
| 10 Jul 2015 08:12 AM |
What does it do? I think it should be a global script.
▲☭⎊▲Obama is a giant overlord space lizard▲⎊☭▲ |
|
|
| Report Abuse |
|