How to /tp only players in survival?

Let's say 3 people are in survival, and 2 people are in creative, What command can I use so it will only TP the people in survival ?


Solution 1:

Use the gamemode tag.

1.13+: /teleport @a[gamemode=survival] x y z
1.12-: /teleport @a[m=0] x y z (0 = survival, 1 = creative, 2 = adventure, 3 = spectator)

This'll teleport all players in survival mode to the location you specify; if you want to teleport the nearest player only, replace @a with @p.

In bedrock, only the 1.12 style command works.