Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Need some help to balance teams in my zombie game?

Asked by
sebanuevo 123
3 years ago

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

Log in to vote
2
Answered by 3 years ago
Edited 3 years ago

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.

0
Let me know if that fixed it. DevMaster333 215 — 3y
0
Im trying it. sebanuevo 123 — 3y
0
It didn't work. sebanuevo 123 — 3y
0
Only put the three lines I gave you. No need to reiterate it a second time. DevMaster333 215 — 3y
View all comments (4 more)
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). DevMaster333 215 — 3y
0
Try the new edit. DevMaster333 215 — 3y
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! sebanuevo 123 — 3y
0
You're welcome, glad I helped you out :) DevMaster333 215 — 3y
Ad

Answer this question