scoreboard players reset @s deathTimer
gamemode adventure @s[scores={location=0..2}]

# Resets title
title @s title {"text":""}
title @s subtitle {"text":""}

# ADD PER MAP
execute as @s[scores={location=0}] run tp @s 0 22 0 facing 0 22 1
execute as @s[scores={location=1..2},tag=powerup,tag=mini] run attribute @s generic.scale base set 0.5
execute as @s[scores={location=1..2}] if score map ssData matches 0 run tp @s 1000 37 4 facing 1000 37 3
execute as @s[scores={location=1..2}] if score map ssData matches 1 run tp @s -967.5 33.5 4.5 facing -968.5 33.5 4.5
execute as @s[scores={location=1..2}] if score map ssData matches 2 run tp @s -5 42.5 1005 facing -4 42.5 1004
execute as @s[scores={location=1..2}] if score map ssData matches 3 run tp @s 32.5 29.5 -999.5 facing 31.5 29.5 -999.5
execute as @s[scores={location=1..2}] if score map ssData matches 4 run tp @s 1000.5 28.5 1000.5 facing 1001.5 28.5 1000.5
execute as @s[scores={location=1..2}] if score map ssData matches 5 in the_nether run tp @s -27.5 56.5 0.5 facing -26.5 56.5 0.5
execute as @s[scores={location=1..2}] if score map ssData matches 6 run tp @s -999.5 82.2 1000.5 facing -999.5 82.2 1001.5
execute as @s[scores={location=1..2}] if score map ssData matches 7 run tp @s 929.5 68.0 -997.5 facing 930.5 68.0 -997.5

# Zombies respawn
execute as @s[scores={location=3}] if score team_lives zombData matches 1.. in ss:zombies run tp @s 0.5 50 0.5 facing 0.5 50 0.6
execute as @s[scores={location=3}] if score team_lives zombData matches 1.. run effect give @s resistance 4 255 true
execute as @s[scores={location=3}] if score team_lives zombData matches 1.. run gamemode adventure @s

# Cancels respawns for players if they are not currently respawning
execute as @s[scores={location=3}] if score team_lives zombData matches 1 run title @a[scores={location=3,deathTimer=-1..}] subtitle [{"text":"Respawn Cancelled","color":"red"},{"text":" | ","color":"gray"},{"text":"Out of Lives!"}]
execute as @s[scores={location=3}] if score team_lives zombData matches 1 run scoreboard players reset @a[scores={location=3,deathTimer=-1..}] deathTimer

# Updates scores and sidebar
execute as @s[scores={location=3}] if score team_lives zombData matches 1.. run tellraw @a[scores={location=3}] [{"text":"⛨ ","color":"green"},{"selector":"@s","color":"gray"},{"text":" |","color":"dark_gray"},{"text":" -","color":"gray"},{"text":"1","color":"white"},{"text":" team life","color":"gray"}]
execute as @s[scores={location=3}] if score team_lives zombData matches 1.. run scoreboard players remove team_lives zombData 1
execute as @s[scores={location=3}] if score team_lives zombData matches 0.. run function ss:zomb/sidebar/update


# Plays sound
execute at @s run playsound minecraft:block.note_block.basedrum master @s ~ ~10000 ~ 10000 1

# Clears potato
clear @s potato

# Actionbar clear
title @s actionbar {"text":""}