PT-BR EN
Channel Icon

Crazy Ozz

Official Channel Website

Command Block

How to Create an Automatic Checkpoint in Minecraft

Version 1.21+ Java Edition

Step 1: Place this command in a Repeat command block and set it to Always Active

execute as @a if entity @s[x=63,y=22,z=-815,dx=0,dy=0,dz=0] run function comandos:spawnpoint1

This command checks if any player is at the specified coordinates and executes a command — in this case, a function.

Just change the coordinates as needed. As for the function being executed with run, I’ll explain it now:

The function allows you to run a set of commands at once, meaning you can execute 2, 3, 4 or more commands together.

Step 2: To create your function, see this video if you’re not familiar. Here are the commands used in my function:

execute if score @s checkpoint matches 0 run spawnpoint @s 63 22 -815 -90

execute if score @s checkpoint matches 0 run tellraw @s [{"text":"Checkpoint reached!","color":"green"}]

execute if score @s checkpoint matches 0 run scoreboard players set @s checkpoint 1

First, we check if the player's score in the checkpoint objective is equal to 0. If it is, the commands are executed.

Since we haven’t set any score yet, it will be 0, and the spawnpoint and tellraw commands will run.

Finally, we set the player’s score to 1 so that the checkpoint doesn’t trigger again.

This last command is mandatory to avoid infinite execution.

Step 3: Place 2 Impulse command blocks side by side with a button and add the following two commands:

One command creates the scoreboard objective, and the other gives players a starting score of 0.

This prevents the command from looping, since no score is set by default.

scoreboard objectives add checkpoint dummy

scoreboard players set @a checkpoint 0

Step 4: Now test it! Press the button created in Step 3 to set up the scoreboards.

Then, go to the coordinates to check if the commands are executed successfully.

Still have questions? Watch the video below