Hello, im working in a balancing system for my game, so there are 2 humans lefts and 3 zombies.
How do you get infected?
My infect system is based on stepping on a infected puddle, and so this will make you a zombie
Whats the problem?
What if everyone steps in the puddle, everyone gets infected and the game isn't fun with everyone a zombie, so we need to balance the teams?!
What did u tried?
I tried many things to solve this, first of all my game has a zombie count, everytime someone becomes a zombie it counts
So with this counter i made some of my tries to solve it (None of them worked)
1 | if workspace.ZombieCount.Value > = #game.Players:GetPlayers() then |
2 | Module.Transform(Hit.Parent) |
3 | end |
1 | if #game.Players:GetPlayers() > workspace.ZombieCount.Value then |
2 | Module.Transform(Hit.Parent) |
3 | end |
What these few lines do
1 | if workspace.ZombieCount.Value > = #game.Players:GetPlayers() then |
2 | Module.Transform(Hit.Parent) |
3 | end |
Is check if the amount of zombies in the workspace is higher or equal to the amount of players. If it is higher or equal to the amount of players, it transforms the player to a zombie.
What it should rather be is:
1 | local Players = game:GetServicer( "Players" ) |
2 |
3 | local zombieCount = workspace.ZombieCount.Value |
4 |
5 | if zombieCount.Value < #(Players:GetPlayers()) then |
6 | -- Increase the value of the zombieCount right away before transforming the player to a zombie. |
7 | zombieCount.Value = zombieCount.Value + 1 |
8 | Module.Transform(Hit.Parent) |
9 | end |
So this way, if the amount of zombies in the workspace is less than the amount of players, it transforms the zombie to a player.