0

In Minecraft java edition, @s stands for "current entity" and works only if you type in chat.

Is there any other way to use the current entity on command block? @s doesn't work there.

1
  • I know thats why asking is any other option there @p but in multiplayer nearest player getting that
    – Geo
    Oct 24, 2021 at 14:57

1 Answer 1

1

@s stands for self (I suppose) and can be set trough as <target> inside execute commands.

You are able to do as such:

execute as @a run say I am @s

The command say I am @s will run once for each target in execute as @a (In this case, every player) and @s will change for each player on each iteration. For example, let us say there are 3 players ingame, Ast, Bor and Cro. execute as @a will act as if each player had typed in their own chat say I am @s resulting in each player type their own name in chat:

[Ast] I am Ast
[Bor] I am Bor
[Cro] I am Cro

Similary, If you use relative positions (~ ~ ~ or ^ ^ ^), these can be set trough at <target>. You can do for example execute as @a at @s which will iterate each player, making @s and relative position use those of the player.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .