execute
Execute a command as other targets or yourself.
This will execute a command just as if you or other players typed a command in the chat window. This command will execute at the position you choose.
mobs.execute(
mobs.target(LOCAL_PLAYER),
pos(0, 0, 0),
""
);
Parameters
- target: a target selector that determines which entities will execute the command
- position: the coordinates where the command runs at
- command: the full command you want the selected targets to execute
Example
When the player types “ping” in the chat, all players reply with “pong”.
player.onChat("ping", function () {
mobs.execute(
mobs.target(ALL_PLAYERS),
pos(0, 0, 0),
"say pong"
);
});