Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Need some help to balance teams in my zombie game?

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)

				if workspace.ZombieCount.Value >= #game.Players:GetPlayers() then
					Module.Transform(Hit.Parent)
				end
				if #game.Players:GetPlayers() > workspace.ZombieCount.Value then
					Module.Transform(Hit.Parent)
				end

1 answer

✓ Accepted answer

What these few lines do

if workspace.ZombieCount.Value >= #game.Players:GetPlayers() then
    Module.Transform(Hit.Parent)
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:

local Players = game:GetServicer("Players")

local zombieCount = workspace.ZombieCount.Value

if zombieCount.Value < #(Players:GetPlayers()) then
-- Increase the value of the zombieCount right away before transforming the player to a zombie.
    zombieCount.Value = zombieCount.Value +1
    Module.Transform(Hit.Parent)
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.

8 comments

0

Let me know if that fixed it.

0

Im trying it.

0

It didn't work.

0

Only put the three lines I gave you. No need to reiterate it a second time.

0

What does the Module.Transform do? I guess it transforms the player to a zombie correct? Also can you increase the CombieCount.Value right before Module.Transform(Hit.Parent).

0

Try the new edit.

0

Im trying an other solution i just made, adding + 1 to the zombie count in the if statement, im accepting your answer thanks for helping!

0

You're welcome, glad I helped you out :)

This discussion is preserved as it was. New answers, comments, and votes are closed.