simple checkpoints script

[Brick] 1nator
Joined 11/10/2017
Posts 11,114
12:36 PM 22/07/2021
world.bricks.filter(checkpoint => checkpoint.name === "checkpoint").forEach(checkpoint => {
checkpoint.touching((player) => {
player.spawnPosition = new Vector3(checkpoint.position.x+2.5,checkpoint.position.y+2.5,checkpoint.position.z+5);
player.centerPrint("checkpoint reached!", 1);
})
})




just name all the parts you want to work as checkpoints "checkpoint"


[Ornge] t.co
Joined 18/07/2021
Posts 6,737
12:38 PM 22/07/2021
[ Content Removed ]


[Brick] 1nator
Joined 11/10/2017
Posts 11,114
12:54 PM 22/07/2021
Quote from t.co , 12:38 PM 22/07/2021
[ Content Removed ]
[ Content Removed ]


[Ornge] t.co
Joined 18/07/2021
Posts 6,737
01:07 PM 22/07/2021
Quote from 1nator , 12:54 PM 22/07/2021
Quote from t.co , 12:38 PM 22/07/2021
[ Content Removed ]

[ Content Removed ]
[ Content Removed ]


Dragonian
Joined 29/05/2017
Posts 2,877
02:55 PM 22/07/2021
Looks good, but this:

player.spawnPosition = new Vector3(checkpoint.position.x+2.5,checkpoint.position.y+2.5,checkpoint.position.z+5);

can be:

player.spawnPosition = checkpoint.position.add(2.5, 2.5, 5)


[Brick] 1nator
Joined 11/10/2017
Posts 11,114
03:31 PM 22/07/2021
Quote from Dragonian , 02:55 PM 22/07/2021
Looks good, but this:

player.spawnPosition = new Vector3(checkpoint.position.x+2.5,checkpoint.position.y+2.5,checkpoint.position.z+5);

can be:

player.spawnPosition = checkpoint.position.add(2.5, 2.5, 5)
oh thanks!


R26
Joined 29/02/2020
Posts 1,006
06:48 PM 23/07/2021
omg cool

1