Minecraft command block player not found error

293 Views Asked by At

I want to give new players items if they join my server, so i used a scoreboard with value 0 if they are new and 1 if they have been on my server before. I used an always active unconditional repeat command block with the command /execute as @a if score @s first_time matches 0. I checked that this one works fine. I placed a conditional always active chain command block in that one with the command give @s stone 1, and the output is "No player found". Why?

1

There are 1 best solutions below

2
Hipposgrumm On

The selector @s refers to self, meaning the command block is running /give on itself, which it cannot do since it's not a player.

Additionally, for your scenario, this is one thing you could do (unconditional repeating command block followed by conditional chain command block, both always active):

give @a[tag=!first_time] <item>
tag @a add first_time

You can also use a datapack function to do this cleaner and all in one tick (and you can use @s).
Datapack Function (firsttimeitem.mcfunction):

give @s <item>
tag @s add first_time

Repeating Command Block (or tick.mcfunction in datapack, your preference):

execute as @a[tag=!first_time] run function <yourdatapacknamespace>:firsttimeitem

Note: You need to replace anything in triangle brackets.