execute @a[tag=Lobby] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Walking
execute @a[tag=Lobby] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sprinting
execute @a[tag=Lobby] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sneaking
execute @a[tag=Lobby] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Jumping
execute @a[tag=Lobby] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Flying

execute @a[tag=LobbyAFK] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Walking
execute @a[tag=LobbyAFK] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sprinting
execute @a[tag=LobbyAFK] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sneaking
execute @a[tag=LobbyAFK] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Jumping
execute @a[tag=LobbyAFK] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Flying

execute @a[tag=LobbySpectate] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Walking
execute @a[tag=LobbySpectate] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sprinting
execute @a[tag=LobbySpectate] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sneaking
execute @a[tag=LobbySpectate] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Jumping
execute @a[tag=LobbySpectate] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Flying

execute @a[tag=LobbyAFKBar] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Walking
execute @a[tag=LobbyAFKBar] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sprinting
execute @a[tag=LobbyAFKBar] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sneaking
execute @a[tag=LobbyAFKBar] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Jumping
execute @a[tag=LobbyAFKBar] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Flying

execute @a[tag=LobbyAFKHowToPlay] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Walking
execute @a[tag=LobbyAFKHowToPlay] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sprinting
execute @a[tag=LobbyAFKHowToPlay] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sneaking
execute @a[tag=LobbyAFKHowToPlay] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Jumping
execute @a[tag=LobbyAFKHowToPlay] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Flying

execute @a[tag=LobbyAFKTesterRoom] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Walking
execute @a[tag=LobbyAFKTesterRoom] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sprinting
execute @a[tag=LobbyAFKTesterRoom] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Sneaking
execute @a[tag=LobbyAFKTesterRoom] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Jumping
execute @a[tag=LobbyAFKTesterRoom] ~ ~ ~ scoreboard players operation @s AFKDetection += @s Flying

execute @a[tag=Lobby] ~ ~ ~ scoreboard players add @s[score_AFKDetection=0,tag=!AFK] AFKTimer 1
execute @a[tag=LobbyAFK] ~ ~ ~ scoreboard players add @s[score_AFKDetection=0,tag=!AFK] AFKTimer 1
execute @a[tag=LobbySpectate] ~ ~ ~ scoreboard players add @s[score_AFKDetection=0,tag=!AFK] AFKTimer 1
execute @a[tag=LobbyAFKBar] ~ ~ ~ scoreboard players add @s[score_AFKDetection=0,tag=!AFK] AFKTimer 1
execute @a[tag=LobbyAFKHowToPlay] ~ ~ ~ scoreboard players add @s[score_AFKDetection=0,tag=!AFK] AFKTimer 1
execute @a[tag=LobbyAFKTesterRoom] ~ ~ ~ scoreboard players add @s[score_AFKDetection=0,tag=!AFK] AFKTimer 1

scoreboard players reset @a[score_AFKDetection_min=1] AFKTimer
scoreboard players reset @a[score_AFKDetection_min=1] Walking
scoreboard players reset @a[score_AFKDetection_min=1] Sprinting
scoreboard players reset @a[score_AFKDetection_min=1] Sneaking
scoreboard players reset @a[score_AFKDetection_min=1] Jumping
scoreboard players reset @a[score_AFKDetection_min=1] Flying
scoreboard players set @a[score_AFKDetection_min=1] AFKDetection 0
summon minecraft:area_effect_cloud 0 105 0 {CustomName:"AFKDetectionTimer",Duration:200,Age:0}