#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    This function has been created by Skilendarz Group.
#             https://skilendarz.com
#
#      GIVE MAP MAKERS THE CREDIT THEY DESERVE!
#             COPYING IS PROHIBITED!
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

tp @s ~ ~ ~
execute store result score @s hitbox_x run data get entity @s Pos[0] 100
execute store result score @s hitbox_y run data get entity @s Pos[1] 100
execute store result score @s hitbox_z run data get entity @s Pos[2] 100

tag @s add this
execute as @e[tag=option_game_type] if score @e[tag=this,limit=1] hitbox_x > @s hitbox_x if score @e[tag=this,limit=1] hitbox_x < @s hitbox_x2 if score @e[tag=this,limit=1] hitbox_y > @s hitbox_y if score @e[tag=this,limit=1] hitbox_y < @s hitbox_y2 if score @e[tag=this,limit=1] hitbox_z > @s hitbox_z if score @e[tag=this,limit=1] hitbox_z < @s hitbox_z2 at @s run function f:lobby/options/game_type/switch
tag @s remove this

scoreboard players add @s main 1
execute if score @s main matches 1..20 positioned ^ ^ ^0.2 run function f:lobby/options/game_type/raycast