Create zombie spawner

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

lateeagle

Active Member
Jan 29, 2025
77
8
8
25
How would i check every Black Concrete Powder block in an area from 380 -41 -68 and 535 -63 66, and spawn a zombie every 100 ticks for 7 minutes
 
How would i check every Black Concrete Powder block in an area from 380 -41 -68 and 535 -63 66, and spawn a zombie every 100 ticks for 7 minutes
i can't understand you clearly. Do you want to check black concrete powders every 100 ticks or do you want a different code? Please explain how the code will work too.
 
once the command is run, it checks every concrete powder block once, they every 100 ticks it spawns zombies for 7 minutes
 
the concrete powder is the only block im not using for builds. it doesnt matter what block it is. It is checking for concrete and spawning zombies on the concrete every 100 ticks 5 seconds
 
Python:
options:
    block: black concrete powder
on load:
    delete {zombiespawnblocks::*}
    loop all blocks within location(0,0,0, world "WORLD_NAME") and location(0,0,0, world "WORLD_NAME"):
        if loop-block is {@block}:
            add loop-block to {zombiespawnblocks::*}
    add 1 to {zombiespawningloop}
    zombieLoop()


local function zombieLoop():
    set {_loopcount} to {zombiespawningloop}
    while {_loopcount} is {zombiespawningloop}:
        loop {zombiespawnblocks::*}:
            set {_loc} to location of block above loop-value
            spawn a zombie at {_loc}
        wait 5 second

I still didn't understand but i think you want something like that.
 
if {selected_map} = "forest":
delete {zombiespawnblocks::*}
loop all blocks within location(535, -41, 66, world "zombie") and location(380,-63, -68, world "zombie"):
if loop-block is {@block}:
add loop-block to {zombiespawnblocks::*}
add 1 to {zombiespawningloop}
zombieLoop()
if {selected_map} = "town":
send "idk" to players

There's no loop that matches 'loop-block' (line 78 and 79)
 
if {selected_map} = "forest":
delete {zombiespawnblocks::*}
loop all blocks within location(535, -41, 66, world "zombie") and location(380,-63, -68, world "zombie"):
if loop-block is {@block}:
add loop-block to {zombiespawnblocks::*}
add 1 to {zombiespawningloop}
zombieLoop()
if {selected_map} = "town":
send "idk" to players

There's no loop that matches 'loop-block' (line 78 and 79)
send me your full code.
 
variables:
{voting} = false
{forest_votes} = 0
{town_votes} = 0

{pvp_votes} = 0
{nopvp_votes} = 0

{selected_map} = "unknown"
{modifier} = "unknown"

command /votingdeny:
executable by: op
permission: votingdeny.command
trigger:
set {voting} to false
send "voting has been ended by an op" to players

options:
block: black concrete powder

local function zombieLoop():
set {_loopcount} to {zombiespawningloop}
while {_loopcount} is {zombiespawningloop}:
loop {zombiespawnblocks::*}:
set {_loc} to location of block above loop-value
spawn a zombie at {_loc}
wait 5 second

function gracePeriod():
send "" to players
send "&a&l&nROUND STARTED" to players
send "" to players
send "&7Grace period for &e30s&7!" to players
send "" to players

execute console command "rg flag -w 'zombie' %{selected_map}% pvp deny"

wait 60 tick

play sound "minecraft:entity.experience_orb.pickup" to players

if {modifier} = "pvp":
send "" to players
send "&a&l&nGAME MODIFIER" to players
send "" to players
send "&7The selected modifier is &c&lPVP&7!" to players
send "" to players
if {modifier} = "nopvp":
send "" to players
send "&a&l&nGAME MODIFIER" to players
send "" to players
send "&7The selected modifier is &a&lNO PVP&7!" to players
send "" to players

wait 540 tick

play sound "minecraft:entity.ender_dragon.growl" to players

if {modifier} = "pvp":
execute console command "rg flag -w 'zombie' %{selected_map}% pvp allow"

send "" to players
send "&c&l&nZOMBIES SPAWNING, PVP ON" to players
send "" to players
send "&7Grace period has ended!" to players
send "" to players
if {modifier} = "nopvp":
send "" to players
send "&c&l&nZOMBIES SPAWNING" to players
send "" to players
send "&7Grace period has ended!" to players
send "" to players

if {selected_map} = "forest":
delete {zombiespawnblocks::*}
loop all blocks within location(535, -41, 66, world "zombie") and location(380,-63, -68, world "zombie"):
if loop-block is {@block}:
add loop-block to {zombiespawnblocks::*}
add 1 to {zombiespawningloop}
zombieLoop()
if {selected_map} = "town":
send "idk" to players

function teleport():
execute console command "time set 15600"
execute console command "timer time set 1m"
execute console command "timer start"
execute console command "team join playing @a"
execute console command "kill @e[type=item]"

heal players by 10 hearts
execute console command "effect clear @a minecraft:saturation"

gracePeriod()

if {selected_map} = "forest":
teleport all players to location(439.5, -60, -11.5, world "zombie")
execute console command "reloadlootforest"

play sound "minecraft:entity.ender_dragon.growl" to players
if {selected_map} = "town":
teleport all players to location(-406.5, -60, 3.5, world "zombie")
execute console command "reloadlootforest"

play sound "minecraft:entity.ender_dragon.growl" to players

function vote(p: player):
set metadata tag "voteGUI" of {_p} to chest inventory with 3 rows named "&8Vote for a map!"
set slot 0 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 1 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 2 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 3 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 4 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 5 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 6 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 7 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 8 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 9 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 10 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 11 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 12 of metadata tag "voteGUI" of {_p} to oak sapling named "&2&lForest" with lore "&7A dark forest filled with uninhabited buildings."
set slot 13 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 14 of metadata tag "voteGUI" of {_p} to spruce stairs named "&9&lTown" with lore "&7A chaotic abandonded town with fire and destruction."
set slot 15 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 16 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 17 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 18 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 19 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 20 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 21 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 22 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 23 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 24 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 25 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 26 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
set slot 27 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
open (metadata tag "voteGUI" of {_p}) to {_p}

function modifier(p: player):
set metadata tag "modifierGUI" of {_p} to chest inventory with 3 rows named "&8Vote for a modifier!"
set slot 0 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 1 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 2 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 3 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 4 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 5 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 6 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 7 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 8 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 9 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 10 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 11 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 12 of metadata tag "modifierGUI" of {_p} to iron sword named "&c&lPVP" with lore "&7Combat other players and zombies."
set slot 13 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 14 of metadata tag "modifierGUI" of {_p} to barrier named "&a&lNo PVP" with lore "&7Combat zombies with other players"
set slot 15 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 16 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 17 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 18 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 19 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 20 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 21 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 22 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 23 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 24 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 25 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 26 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
set slot 27 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
open (metadata tag "modifierGUI" of {_p}) to {_p}

function start():
if {voting} is true:
loop all players:
vote(loop-player)

send "" to players
send "&a&l&nNEW ROUND" to players
send "" to players
send "&7Map voting has begun! &e15s" to players
send "" to players

wait 600 tick

close inventory of players
play sound "minecraft:entity.experience_orb.pickup" to players

send "" to players
send "&a&l&nVOTING RESULTS" to players
send "" to players
send "&2&lForest &7- &f%{forest_votes}% &7votes" to players
send "&9&lTown &7- &f%{town_votes}% &7votes" to players
send "" to players

set {forest_votes} to 0
set {town_votes} to 0

wait 60 tick

loop all players:
modifier(loop-player)

send "" to players
send "&a&l&nMODIFIER VOTING" to players
send "" to players
send "&7Vote for a game modifier! &e15s" to players
send "" to players

wait 600 tick

close inventory of players
play sound "minecraft:entity.experience_orb.pickup" to players

send "" to players
send "&a&l&nVOTING RESULTS" to players
send "" to players
send "&c&lPVP &7- &f%{pvp_votes}% &7votes" to players
send "&a&lNo PVP &7- &f%{nopvp_votes}% &7votes" to players
send "" to players

set {pvp_votes} to 0
set {nopvp_votes} to 0

wait 60 tick

play sound "minecraft:entity.ender_pearl.throw" to players
send "" to players
send "&a&l&nSTARTING ROUND" to players
send "" to players
send "&7Round begins in &e3s" to players

wait 20 tick

send "&7Round begins in &e2s" to players
play sound "minecraft:entity.ender_pearl.throw" to players

wait 20 tick

send "&7Round begins in &e1s" to players
play sound "minecraft:entity.ender_pearl.throw" to players

wait 20 tick

set {voting} to false
execute console command "effect give @a minecraft:blindness 2"

if {pvp_votes} >= {nopvp_votes}:
set {modifier} to "pvp"
else if {nopvp_votes} >= {pvp_votes}:
set {selected_map} to "nopvp"
else:
{random_number} = 0
set {random_number} to a random integer between 1 and 2

if {random_number} = 1:
set {modifier} to "pvp"
else if {random_number} = 2:
set {modifier} to "nopvp"

if {forest_votes} >= {town_votes}:
set {selected_map} to "forest"

teleport()
else if {town_votes} >= {forest_votes}:
set {selected_map} to "city"

teleport()
else:
{random_number} = 0
set {random_number} to a random integer between 1 and 2

if {random_number} = 1:
set {selected_map} to "forest"
else if {random_number} = 2:
set {selected_map} to "town"

teleport()

on inventory click:
if event-inventory = (metadata tag "voteGUI" of player):
cancel event

if index of event-slot is 12:
close inventory of player
add 1 to {forest_votes}
send "&f%player% has voted &2&lForest&f!" to players
play sound "minecraft:entity.experience_orb.pickup" to players
else if index of event-slot is 14:
close inventory of player
add 1 to {town_votes}
send "&f%player% has voted &9&lTown&f!" to players
play sound "minecraft:entity.experience_orb.pickup" to player
if event-inventory = (metadata tag "modifierGUI" of player):
cancel event

if index of event-slot is 12:
close inventory of player
add 1 to {pvp_votes}
send "&f%player% has voted &c&lPVP&f!" to players
play sound "minecraft:entity.experience_orb.pickup" to players
else if index of event-slot is 14:
close inventory of player
add 1 to {nopvp_votes}
send "&f%player% has voted &a&lNO PVP&f!" to players
play sound "minecraft:entity.experience_orb.pickup" to player
on join:
set join message to "&8[&a✔&8] &f%player%"

execute console command "clear %player%"
execute console command "effect give %player% minecraft:saturation infinite"

set {spawn} to location(-4.5, -55.5, 1.5)
set pitch of {spawn} to 0
set yaw of {spawn} to -180
teleport player to {spawn}

if amount of all players is equal to 1:
if {voting} is false:
execute console command "timer time set 1m"
execute console command "timer pause"

execute console command "team add playing"
wait 40 ticks

set {voting} to true
start()
else:
wait 40 ticks
vote(player)
on quit:
set quit message to "&8[&c❌&8] &f%player%"

if amount of all players is equal to 0:
execute console command "team remove playing"
set {voting} to false

set {forest_votes} to 0
set {town_votes} to 0

set {pvp_votes} to 0
set {nopvp_votes} to 0

on right click on iron door:
if held item of player is tripwire hook:
cancel event
play sound "minecraft:entity.zombie.attack_iron_door" at event-block to player
send "&e%player% has opened a vault!" to players
send title "&a&lVAULT OPENED!" with subtitle "&7You opened a vault!" to player for 5 seconds

if block under event-block is iron door:
set block under event-block to air
else:
set event-block to air
 
1739035664585.png


Send it from here including spaces/tabs.
 
Code:
variables:
  {voting} = false
  {forest_votes} = 0
  {town_votes} = 0
 
  {pvp_votes} = 0
  {nopvp_votes} = 0
 
  {selected_map} = "unknown"
  {modifier} = "unknown"
 
command /votingdeny:
    executable by: op
    permission: votingdeny.command
    trigger:
        set {voting} to false
        send "voting has been ended by an op" to players

options:
    block: black concrete powder

local function zombieLoop():
    set {_loopcount} to {zombiespawningloop}
    while {_loopcount} is {zombiespawningloop}:
        loop {zombiespawnblocks::*}:
            set {_loc} to location of block above loop-value
            spawn a zombie at {_loc}
        wait 5 second

function gracePeriod():
    send "" to players
    send "&a&l&nROUND STARTED" to players
    send "" to players
    send "&7Grace period for &e30s&7!" to players
    send "" to players
    
    execute console command "rg flag -w 'zombie' %{selected_map}% pvp deny"
    
    wait 60 tick

    play sound "minecraft:entity.experience_orb.pickup" to players

    if {modifier} = "pvp":
        send "" to players
        send "&a&l&nGAME MODIFIER" to players
        send "" to players
        send "&7The selected modifier is &c&lPVP&7!" to players
        send "" to players
    if {modifier} = "nopvp":
        send "" to players
        send "&a&l&nGAME MODIFIER" to players
        send "" to players
        send "&7The selected modifier is &a&lNO PVP&7!" to players
        send "" to players
    
    wait 540 tick
            
    play sound "minecraft:entity.ender_dragon.growl" to players

    if {modifier} = "pvp":
        execute console command "rg flag -w 'zombie' %{selected_map}% pvp allow"

        send "" to players
        send "&c&l&nZOMBIES SPAWNING, PVP ON" to players
        send "" to players
        send "&7Grace period has ended!" to players
        send "" to players
    if {modifier} = "nopvp":
        send "" to players
        send "&c&l&nZOMBIES SPAWNING" to players
        send "" to players
        send "&7Grace period has ended!" to players
        send "" to players

        if {selected_map} = "forest":
        delete {zombiespawnblocks::*}
        loop all blocks within location(535, -41, 66, world "zombie") and location(380,-63, -68, world "zombie"):
        if loop-block is {@block}:
        add loop-block to {zombiespawnblocks::*}
        add 1 to {zombiespawningloop}
        zombieLoop()
        if {selected_map} = "town":
        send "idk" to players

function teleport():
    execute console command "time set 15600"
    execute console command "timer time set 1m"
    execute console command "timer start"
    execute console command "team join playing @a"
    execute console command "kill @e[type=item]"
    
    heal players by 10 hearts
    execute console command "effect clear @a minecraft:saturation"

    gracePeriod()
    
    if {selected_map} = "forest":
        teleport all players to location(439.5, -60, -11.5, world "zombie")
        execute console command "reloadlootforest"
        
        play sound "minecraft:entity.ender_dragon.growl" to players
    if {selected_map} = "town":
        teleport all players to location(-406.5, -60, 3.5, world "zombie")
        execute console command "reloadlootforest"
        
        play sound "minecraft:entity.ender_dragon.growl" to players
        
function vote(p: player):
    set metadata tag "voteGUI" of {_p} to chest inventory with 3 rows named "&8Vote for a map!"
    set slot 0 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 1 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 2 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 3 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 4 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 5 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 6 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 7 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 8 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 9 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 10 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 11 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 12 of metadata tag "voteGUI" of {_p} to oak sapling named "&2&lForest" with lore "&7A dark forest filled with uninhabited buildings."
    set slot 13 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 14 of metadata tag "voteGUI" of {_p} to spruce stairs named "&9&lTown" with lore "&7A chaotic abandonded town with fire and destruction."
    set slot 15 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 16 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 17 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 18 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 19 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 20 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 21 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 22 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 23 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 24 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 25 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 26 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    set slot 27 of metadata tag "voteGUI" of {_p} to black stained glass pane named " "
    open (metadata tag "voteGUI" of {_p}) to {_p}

function modifier(p: player):
    set metadata tag "modifierGUI" of {_p} to chest inventory with 3 rows named "&8Vote for a modifier!"
    set slot 0 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 1 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 2 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 3 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 4 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 5 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 6 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 7 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 8 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 9 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 10 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 11 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 12 of metadata tag "modifierGUI" of {_p} to iron sword named "&c&lPVP" with lore "&7Combat other players and zombies."
    set slot 13 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 14 of metadata tag "modifierGUI" of {_p} to barrier named "&a&lNo PVP" with lore "&7Combat zombies with other players"
    set slot 15 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 16 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 17 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 18 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 19 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 20 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 21 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 22 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 23 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 24 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 25 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 26 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    set slot 27 of metadata tag "modifierGUI" of {_p} to black stained glass pane named " "
    open (metadata tag "modifierGUI" of {_p}) to {_p}

function start():
    if {voting} is true:
        loop all players:
            vote(loop-player)

        send "" to players
        send "&a&l&nNEW ROUND" to players
        send "" to players
        send "&7Map voting has begun! &e15s" to players
        send "" to players

        wait 600 tick

        close inventory of players
        play sound "minecraft:entity.experience_orb.pickup" to players

        send "" to players
        send "&a&l&nVOTING RESULTS" to players
        send "" to players
        send "&2&lForest &7- &f%{forest_votes}% &7votes" to players
        send "&9&lTown &7- &f%{town_votes}% &7votes" to players
        send "" to players

        set {forest_votes} to 0
        set {town_votes} to 0

        wait 60 tick

        loop all players:
            modifier(loop-player)

        send "" to players
        send "&a&l&nMODIFIER VOTING" to players
        send "" to players
        send "&7Vote for a game modifier! &e15s" to players
        send "" to players

        wait 600 tick

        close inventory of players
        play sound "minecraft:entity.experience_orb.pickup" to players

        send "" to players
        send "&a&l&nVOTING RESULTS" to players
        send "" to players
        send "&c&lPVP &7- &f%{pvp_votes}% &7votes" to players
        send "&a&lNo PVP &7- &f%{nopvp_votes}% &7votes" to players
        send "" to players

        set {pvp_votes} to 0
        set {nopvp_votes} to 0

        wait 60 tick

        play sound "minecraft:entity.ender_pearl.throw" to players
        send "" to players
        send "&a&l&nSTARTING ROUND" to players
        send "" to players
        send "&7Round begins in &e3s" to players

        wait 20 tick
        
        send "&7Round begins in &e2s" to players
        play sound "minecraft:entity.ender_pearl.throw" to players

        wait 20 tick
        
        send "&7Round begins in &e1s" to players
        play sound "minecraft:entity.ender_pearl.throw" to players

        wait 20 tick

        set {voting} to false
        execute console command "effect give @a minecraft:blindness 2"

        if {pvp_votes} >= {nopvp_votes}:
            set {modifier} to "pvp"
        else if {nopvp_votes} >= {pvp_votes}:
            set {selected_map} to "nopvp"
        else:
            {random_number} = 0
            set {random_number} to a random integer between 1 and 2
            
            if {random_number} = 1:
                set {modifier} to "pvp"
            else if {random_number} = 2:
                set {modifier} to "nopvp"

        if {forest_votes} >= {town_votes}:
            set {selected_map} to "forest"

            teleport()
        else if {town_votes} >= {forest_votes}:
            set {selected_map} to "city"

            teleport()
        else:
            {random_number} = 0
            set {random_number} to a random integer between 1 and 2
            
            if {random_number} = 1:
                set {selected_map} to "forest"
            else if {random_number} = 2:
                set {selected_map} to "town"

            teleport()

on inventory click:
    if event-inventory = (metadata tag "voteGUI" of player):
        cancel event
        
        if index of event-slot is 12:
            close inventory of player
            add 1 to {forest_votes}
            send "&f%player% has voted &2&lForest&f!" to players
            play sound "minecraft:entity.experience_orb.pickup" to players
        else if index of event-slot is 14:
            close inventory of player
            add 1 to {town_votes}
            send "&f%player% has voted &9&lTown&f!" to players
            play sound "minecraft:entity.experience_orb.pickup" to player
    if event-inventory = (metadata tag "modifierGUI" of player):
        cancel event
        
        if index of event-slot is 12:
            close inventory of player
            add 1 to {pvp_votes}
            send "&f%player% has voted &c&lPVP&f!" to players
            play sound "minecraft:entity.experience_orb.pickup" to players
        else if index of event-slot is 14:
            close inventory of player
            add 1 to {nopvp_votes}
            send "&f%player% has voted &a&lNO PVP&f!" to players
            play sound "minecraft:entity.experience_orb.pickup" to player
on join:
    set join message to "&8[&a✔&8] &f%player%"

    execute console command "clear %player%"
    execute console command "effect give %player% minecraft:saturation infinite"

    set {spawn} to location(-4.5, -55.5, 1.5)
    set pitch of {spawn} to 0
    set yaw of {spawn} to -180
    teleport player to {spawn}

    if amount of all players is equal to 1:
        if {voting} is false:
            execute console command "timer time set 1m"
            execute console command "timer pause"

            execute console command "team add playing"
            wait 40 ticks
            
            set {voting} to true
            start()
    else:
        wait 40 ticks
        vote(player)
on quit:
    set quit message to "&8[&c❌&8] &f%player%"

    if amount of all players is equal to 0:
        execute console command "team remove playing"
        set {voting} to false

        set {forest_votes} to 0
        set {town_votes} to 0
 
        set {pvp_votes} to 0
        set {nopvp_votes} to 0

on respawn:
    execute console command "team leave %player%"
    send title "&c&lYOU DIED!" with subtitle "&7Game over!" to player for 5 seconds

on right click on iron door:
    if held item of player is tripwire hook:
        cancel event
        play sound "minecraft:entity.zombie.attack_iron_door" at event-block to player
        send "&e%player% has opened a vault!" to players
        send title "&a&lVAULT OPENED!" with subtitle "&7You opened a vault!" to player for 5 seconds
        
        if block under event-block is iron door:
            set block under event-block to air
        else:
            set event-block to air
 
Python:
        delete {zombiespawnblocks::*}
        loop all blocks within location(535, -41, 66, world "zombie") and location(380,-63, -68, world "zombie"):
            if loop-block is {@block}:
                add loop-block to {zombiespawnblocks::*}
               
        add 1 to {zombiespawningloop}
        zombieLoop()

        if {selected_map} = "town": # this is useless...
        send "idk" to players

        # alternative:

        # if {selected_map} = "town": # this is useless...
        #     send "idk" to players

There are too much errors with your indentations. I didn't look out to whole code but i fixed the place where you added the code.
 
Plus the reason I added the "town" one was to test if it worked first before adding it to both maps