#Entering
tellraw @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=Lobby] ["",{"text":"Freezun","color":"aqua","bold":"true"},{"text":" » ","color":"dark_gray"},{"text":"You have entered the Bar. You won't be able to play the game until you leave it. ","bold":false,"color":"aqua"}]
clear @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=Lobby] dye
playsound minecraft:record.stal player @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=Lobby] 531 88 471 1.8

clear @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=Lobby] minecraft:snowball
clear @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=Lobby] minecraft:barrier
scoreboard players reset @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=Lobby] GiveSecret
scoreboard players tag @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=Lobby] remove TestforSecretItem
scoreboard players tag @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=Lobby] remove TestforSecretItem1

scoreboard players tag @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=Lobby] remove Lobby
execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=!LobbyAFKBar] ~ ~ ~ function main:scoreboard/lobby if @s[tag=!LobbySpectate]
execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=!LobbyAFKBar] ~ ~ ~ scoreboard players tag @s[tag=!LobbySpectate] add LobbyAFKBar

#Entering
tellraw @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] ["",{"text":"Freezun","color":"aqua","bold":"true"},{"text":" » ","color":"dark_gray"},{"text":"You have entered the Bar. You won't be able to play the game until you leave it. ","bold":false,"color":"aqua"}]
clear @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] dye
playsound minecraft:record.stal player @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] 531 88 471 1.8

clear @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] minecraft:snowball
clear @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] minecraft:barrier
scoreboard players reset @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] GiveSecret
scoreboard players tag @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] remove TestforSecretItem
scoreboard players tag @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] remove TestforSecretItem1

scoreboard players tag @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] add LobbyAFKBar
scoreboard players tag @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbyAFK] remove LobbyAFK

#Entering
execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbySpectate] ~ ~ ~ tellraw @s[tag=!LobbyAFKBar] ["",{"text":"Freezun","color":"aqua","bold":"true"},{"text":" » ","color":"dark_gray"},{"text":"You have entered the Bar. You won't be able to play the game until you leave it. ","bold":false,"color":"aqua"}]
execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbySpectate] ~ ~ ~ clear @s[tag=!LobbyAFKBar] dye
execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbySpectate] ~ ~ ~ playsound minecraft:record.stal player @s[tag=!LobbyAFKBar] 531 88 471 1.8

execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbySpectate] ~ ~ ~ clear @s[tag=!LobbyAFKBar] minecraft:snowball
execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbySpectate] ~ ~ ~ clear @s[tag=!LobbyAFKBar] minecraft:barrier
execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbySpectate] ~ ~ ~ scoreboard players reset @s[tag=!LobbyAFKBar] GiveSecret
execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbySpectate] ~ ~ ~ scoreboard players tag @s[tag=!LobbyAFKBar] remove TestforSecretItem
execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbySpectate] ~ ~ ~ scoreboard players tag @s[tag=!LobbyAFKBar] remove TestforSecretItem1

execute @a[x=506,y=87,z=470,dx=2,dy=3,dz=2,tag=LobbySpectate] ~ ~ ~ scoreboard players tag @s[tag=!LobbyAFKBar] add LobbyAFKBar

#Exiting
tellraw @a[x=503,y=90,z=470,dy=3,dz=2,tag=LobbyAFKBar] ["",{"text":"Freezun","color":"aqua","bold":"true"},{"text":" » ","color":"dark_gray"},{"text":"You have left the Bar. You are now able to play the game. ","bold":false,"color":"aqua"}]
scoreboard players reset @a[x=503,y=90,z=470,dy=3,dz=2,tag=LobbyAFKBar] MusicTime
stopsound @a[x=503,y=90,z=470,dy=3,dz=2,tag=LobbyAFKBar]
scoreboard players tag @a[x=503,y=90,z=470,dy=3,dz=2,tag=LobbyAFKBar] add Lobby
scoreboard players tag @a[x=503,y=90,z=470,dy=3,dz=2,tag=LobbySpectate] remove Lobby
function main:scoreboard/lobby if @a[x=503,y=90,z=470,dy=3,dz=2,tag=LobbyAFKBar]
scoreboard players tag @a[x=503,y=90,z=470,dy=3,dz=2,tag=LobbyAFKBar] remove LobbyAFKBar