How to make a checkpoint system with percent progression

hey all, i am currently trying to make a racing system. I have all of the basic stuff that is needed, but I don’t know how to integrate checkpoints into it, and how far the player is through the race in percent.

2 Likes

Maybe check the X position of the player’s CFrame, and make a percentage out of that with the length of the course and the player’s progress. Checkpoints are covered by roblox: https://education.roblox.com/en-us/resources/intro-to-game-design-intro-to-studio-creating-checkpoints

1 Like

what if the length of the course has turns, how can i calculate the length of the course if the course has winding bends?

Although I’m not experienced with it, you may want to look into path finding then. A tutorial I found: https://www.youtube.com/watch?v=VWKNtqjPKn0

If I was going to pull this off, I’d place waypoints across the length of the track and calculate distance from each waypoint, marking each one as they pass. Then you just calculate percentage from waypoints passed / total waypoints.

thanks for the tutorial, ill check it out and see if it helps.

This would work, but is probably inaccurate unless you’re placing 75+ waypoints.

looking into pathfinding seem to be the best way to get to what i am trying to achieve, ill whip a script up and test to make sure.

That’d be the idea really, but you can increase accuracy by calculating distance between each point too. So if you had 50 points and reach point 10, you’d be at 10 ÷ 50 = 0.2 × 100 = 20% and then halfway between point 10 and 11 would be 10.5 ÷ 50 = 0.21 × 100 = 21%.

Yeah, each way has their own pros and cons. Your’s is probably more reliable, but also time consuming.

For a checkpoint you just need to use datastore, as I saw, you said there are turns.

So in the datastore you save {position, currentTurn}.

To the percent progression I dont really know but you can try doing currentPosition/maxPosition * 100 and this will give you a percentage. So if you were to make a text it would be

(currentPosition/maxPosition * 100)…“% Progression.”