2

I am building a musical chairs Minecraft map, and I was wondering if there is a way to kill all players who aren't riding in a minecart?

1
  • 1
    You should usually not mark answers as accepted too soon, that discourages other answers. And especially in this case, the answer you marked as accepted does not actually solve the question properly (there are many cases where it fails), but there is indeed a straightforward, 100% working solution to what you want (which I'm writing currently). Commented May 6, 2020 at 7:09

2 Answers 2

1

The tag you're looking for is RootVehicle:

/kill @a[nbt=!{RootVehicle:{Entity:{id:"minecraft:minecart"}}}]
1

The closest thing I can think of is setting up your minecarts like this (with the rails):

The Minecart Setup

Then enter /execute positioned as @a if block ~ ~-1 ~ grass_block run kill @p Replace grass_block with your floor material (assuming that the material under the minecarts are the same).

When a player is in a minecart, the block under them will be the rail instead of the floor block (in this case, grass_block). Those who are standing on the floor (the block under them is the floor block) will be killed.

However, there is only one problem. Players can survive by jumping. One solution is to make the whole room 2 blocks high, or to put barrier blocks above the players' heads.

2
  • I don't think you need to surround it with quartz slabs though. As long as the minecart stays in one spot.
    – fwoosh
    Commented May 5, 2020 at 21:49
  • Is my English really that bad? Anyway, the quartz slabs were just for keeping it in place while I tried different things, I just didn't remove when taking the screenshot.
    – Ryan
    Commented May 8, 2020 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.