Minecraft Command Block “You must specify which player you wish to perform this action on.”

minecraft-commandsminecraft-java-edition

I am trying to make a "Minecart Elevator" using command blocks. My main block has this command: /tp @e[type=MinecartRideable, r=21] ~ ~+3.3 ~. When I don't have the , r=21 part, my command works, just without the radius. But, when I add the radius back in, I get this error:

You must specify which player you wish to perform this action on. 

How can I fix this?

Best Answer

You cannot have spaces in target selectors. It is assuming you are skipping to the next part of the command's syntax.

/tp @e[type=MinecartRideable,r=21] ~ ~+3.3 ~