execute as @a at @s positioned 87 31 6 if entity @s[distance=..20] at @s run function koncept:spawn2

scoreboard players add @e[type=minecraft:text_display,tag=text_start] spawn 1

data merge entity @e[type=minecraft:text_display,tag=text_start,limit=1,scores={spawn=1}] {start_interpolation:-1,interpolation_duration:30,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0.5f,0f],scale:[2f,2f,2f]}}

data merge entity @e[type=minecraft:text_display,tag=text_start,limit=1,scores={spawn=30}] {start_interpolation:-1,interpolation_duration:30,transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0.0f,0f],scale:[2f,2f,2f]}}

scoreboard players reset @e[type=minecraft:text_display,tag=text_start,scores={spawn=60}] spawn

execute as @a at @s positioned 87 31 6 unless entity @a[distance=..20,tag=!start_player] at @s if score spawn spawn matches 2 run scoreboard players set spawn spawn 3


execute if score spawn spawn matches 3 run scoreboard players add spawn1 spawn 1

execute if score spawn1 spawn matches 80 run function koncept:spawn/main_destroy

execute if score spawn1 spawn matches 80 run scoreboard players set spawn spawn 0
execute if score spawn1 spawn matches 80 run scoreboard players set spawn1 spawn 0


