simple checkpoints script

[Brick] 1nator
Joined 11/10/2017
Posts 7,694
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"


Fresh Lemonade
Joined 18/07/2021
Posts 366
12:38 PM 22/07/2021
[ Content Removed ]


[Brick] 1nator
Joined 11/10/2017
Posts 7,694
12:54 PM 22/07/2021
Quote from Fresh Lemonade , 12:38 PM 22/07/2021
[ Content Removed ]
[ Content Removed ]


Fresh Lemonade
Joined 18/07/2021
Posts 366
01:07 PM 22/07/2021
Quote from 1nator , 12:54 PM 22/07/2021
Quote from Fresh Lemonade , 12:38 PM 22/07/2021
[ Content Removed ]

[ Content Removed ]
[ Content Removed ]


Dragonian
Joined 29/05/2017
Posts 2,545
Administrator
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 7,694
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 662
06:48 PM 23/07/2021
omg cool

1