How to make a quick round based zombie game with waves?

Hello!

I want to make a round based zombie survival game where the players get weapons and have 20 seconds to get in position, then they have 3 minutes to defeat all waves, and then the game repeats, the zombies spawn in with waves of 1 - 6 (random chance)
and i also want them to spawn at these four locations randomly:

The four spots circled in red is where i would like the to spawn, the game would choose a location randomly, if a player dies, i want them to spawn on top of the map to spectate the others, if they run out of time a new game starts, once the game detects that all zombies are dead, the dead players come back to the map and then it repeats!

Also this is where i would want the timer and the messages to be located at:

It would be a TextLabel

The only massive problem is i don’t know how to make a round - based zombie survival game!
I would like explanations and examples of how to do this!

Cheers! :wink:

2 Likes
local roundMsg = game.ReplicatedStorage.Values:WaitForChild("roundMsg")
local zombieCount = game.ReplicatedStorage.Values:WaitForChild("zombiesRemaining")
local zombiesAlive = game.ReplicatedStorage.Values:WaitForChild("zombiesAlive")
local gameInProgress = game.ReplicatedStorage.Values:WaitForChild("gameInProgress")
local wave = game.ReplicatedStorage.Values:WaitForChild("Wave")
local collectionservice = game:GetService("CollectionService")
 
 
while true do
    for i = 15,0,-1 do
        roundMsg.Value = "Game Starting in: "..i
        if i == 1 then
            local map = math.random(1,3)
            if map == 1 then
                game.ReplicatedStorage.Maps.Normal:Clone().Parent = workspace.Map
            end
            if map == 2 then
                game.ReplicatedStorage.Maps.Red:Clone().Parent = workspace.Map
            end
            if map == 3 then
                game.ReplicatedStorage.Maps.Green:Clone().Parent = workspace.Map
            end
            print(map)
            for i, v in pairs(game.Players:GetPlayers()) do
                collectionservice:AddTag(v.Character, "Alive")
                v.Character.UpperTorso.CFrame = workspace.Map:FindFirstChildOfClass("Model").Spawn.CFrame
            end
            roundMsg.Value = "Game In Progress"
            zombieCount.Value = 6
            zombiesAlive.Value = 6
            wave.Value = 1
            gameInProgress.Value = true
        
            repeat
                if #collectionservice:GetTagged("Alive") > 0 then
                    if zombiesAlive.Value == 0 then
                        wave.Value = wave.Value + 1
                        zombieCount.Value = 6 * wave.Value
                        zombiesAlive.Value = 6 * wave.Value
                    end
                    elseif #collectionservice:GetTagged("Alive") == 0 then
                    gameInProgress = false
                end
                wait(1)
            until gameInProgress == false
                workspace.Map:ClearAllChildren()
        end
    wait(1)
    end
end

Here is the code for round based system.

2 Likes

Do you need the zombie spawner too or you have already made it ?

1 Like

This script is for only 3 round based.
So, if you want to add more rounds, then change this script which is below :point_down:t3:.

if i == 1 then
            local map = math.random(1,3)
            if map == 1 then
                game.ReplicatedStorage.Maps.Normal:Clone().Parent = workspace.Map
            end
            if map == 2 then
                game.ReplicatedStorage.Maps.Red:Clone().Parent = workspace.Map
            end
            if map == 3 then
                game.ReplicatedStorage.Maps.Green:Clone().Parent = workspace.Map
            end

Here is the code for zombie spawner script below.

while true do
	if game.ReplicatedStorage.Values.gameInProgress.Value == true then
	if game.ReplicatedStorage.Values.zombiesRemaining.Value > 0 then
		local NPC = game.ReplicatedStorage.Zombie:Clone()
		NPC.Parent = script.Parent
		NPC.UpperTorso.CFrame = script.Parent.CFrame
		game.ReplicatedStorage.Values.zombiesRemaining.Value = game.ReplicatedStorage.Values.zombiesRemaining.Value - 1
	end
	end
	wait(5)
end

Try this zombie model Basic Zombie by Code: Orange - Roblox in order to make this code work or just work on with your own zombie model.

Here is the GUI script below.

local countdown = game.ReplicatedStorage.Values:WaitForChild("roundMsg")
local wave = game.ReplicatedStorage.Values:WaitForChild("Wave")

countdown.Changed:connect(function()
	script.Parent.Text = countdown.Value
end)

wave.Changed:connect(function()
	script.Parent.Parent.waveNumber.Text = wave.Value
end)

I hope this will help you :slight_smile:

You should probably lookup a few YouTube tutorials, this section is for assistance with existing code you’ve written not for making fully-fledged projects.

3 Likes