I need help with a command block /execute command [duplicate]

Solution 1:

You put type=armor stand when it needs to be type=armor_stand

Solution 2:

Your command with the new syntax is:

/execute at @e[type=armor_stand,tag=Spawn] /spawnpoint @r ~ ~ ~

But why?

First, let's break this down into two separate commands, effectively allowing us to narrow our focus and understand how each works individually, with respect to the entire command, of course. Finally, after we understand both commands, we'll turn our attention to the target selectors being utilized so we can understand how they work in the grand scheme of things.

The spawnpoint Command

The spawnpoint command uses the following syntax:

/spawnpoint [targets] [pos]

This command enables you to reset the spawn point for a player to a new location. Here targets is replaced with your target selector and pos is replaced with the three components of the positional vector representing the desired spawn location.

The execute Command

The execute command, with respect to the original command you published uses the syntax:

/execute <entity> <x> <y> <z> <command>

This syntax is only available in Minecraft Java Edition (PC/Mac) versions 1.11 and 1.12, and it enables you to execute a command on behalf of an entity. Here entity is replaced with your target selector, x, y, and z are the individual components of your positional vector, and command is the command you wish to execute; in your case, spawnpoint.

The new syntax for this command is:

/execute at <targets> <secondExecuteCommand>
The @r Target Selector

This target selector is used to select a random player in the game. In the first portion of your command, you're selecting a random armor stand with a tag of spawn; however, you need to use @e which selects entities (an armor_stand is not a player but it is an entity). In the second portion, you're simply selecting a random player.

What is this command doing?

Well, it executes the spawnpoint command, targeting a random player, on behalf of a randomly selected armor stand with a tag of spawn. The selected player's spawn point is set to the position of the selected armor stand.

Let's Upgrade!

So you'll notice that the positional components are missing in the new syntax and we get a new keyword as. The as actually simplifies the command and sets the positional components to the location of the entity the command is being executed from. Additionally, since the spawnpoint command hasn't changed syntax, it stays the same in your new command. To upgrade it, we remove the positional components from the execute command and add the as keyword:

/execute at @e[type=armor_stand,tag=Spawn] /spawnpoint @r ~ ~ ~