Minecraft Bedrock Command block selecting a target with coordinates syntax help

minecraft-bedrock-editionminecraft-commands

I am playing on my own bedrock realm with the non java version of Minecraft. I wish to let my kids change their game mode to creative as survival is the default but I don’t want to grant the OP permissions as they tend to start doing things to each other with OP commands and chaos ensues.

I have tried many variations along the same theme of having a pressure plate that triggers a hidden command block 3 blocks below. I would rather not have to go down the route of boxing in the pressure plate and using a proximity selector.

So I am trying to get this very simple command to work:
gamemode s @p[44.70,63.00,31.49]

I have tried with and without brackets, with and without commas but everything so far throws the same exception. Syntax error: Unexpected "44.70": at "mode s @p[>>44.70<<,63.00,61.
This is the same error if I try @a or @e. Obviously, I'm doing something wrong with my syntax I just don't know what.

Any help would be greatly appreciated. Sorry if this has been asked before, I did search and found a lot of questions that were very close but none answered this with how to use coords as a selecter and the correct syntax.

Best Answer

Selector arguments are in a key=value format, so you'll need to add x=, y=, and z= before the values.

You'll also need to specify a radius (r) from those coordinates to select players within.

The following command should work:

gamemode s @p[x=44.70,y=63.00,z=31.49,r=1]