Minecraft – How to place a red block under a red team member who is on a white block

minecraft-commandsminecraft-java-edition

I'm trying to create a MineCraft minigame for practise with command blocks, and I don't know how to place a block under a specific person with specific conditions. The conditions varying based on what team they are on.

I have:

Repeating

Chain

execute @a[team=red] ~ ~ ~ testforblock ~ ~-1 ~ concrete 0

Conditional Chain

execute @a[team=red] ~ ~ ~ setblock ~ ~-1 ~ concrete 14

I'm quite sure the way it is set up now whenever any red team member stands on white concrete, red concrete is placed below all of them. I can fix this, with it always placing red concrete below them, but then they break it when they jump. I'm also thinking of giving them points when they replace white or blue concrete, so I need to at least know how to update the score of a specific player on a team.

For now I am going to make each team hold 1 player, and the score held for the whole team.

Best Answer

/testfor is rarely used nowadays, because there are better ways:

/execute at @a[team=red] run fill ~ ~-1 ~ ~ ~-1 ~ red_concrete replace white_concrete