I need help fixing my 3 lap time trial system

Hey! I keep running into a problem, and I am making a Mariokart type game, with time trials and everything, and I came into another problem with Time Trials. I have 1 laps maps, those were easy to work on time trials. Now I have 3 lap maps, and oh boy it is not going good. When people hit these parts values do save but, it is not adding a lap, and it does the final lap procedure every time.

When you cross the finish line

local lapcounter = script.Parent.Parent.Parent.Parent.Lap.TextLabel.LapCounter.RealLapNumber
local eelapcounter = script.Parent.Parent.Parent.Parent.Lap.TextLabel.LapCounter.LapNumber
local stopwatchvalue = script.Parent.Parent.Parent.Parent.StopWatch.Window.StopwatchValue

game.ReplicatedStorage.EndRace.OnClientEvent:Connect(function()
	if script.Parent.Parent.Parent.Parent.Bools.AllowedToAdvance.Value == true then
		script.Parent.Parent.Parent.Parent.Bools.AllowedToAdvance.Value = false
		lapcounter.Value = eelapcounter.Value
	elseif script.Parent.Parent.Parent.Parent.Bools.AllowedToEndRace.Value == true then
		script.Parent.Parent.Parent.Parent.Bools.AllowedToEndRace.Value = false
		script.Parent.Text = stopwatchvalue.Value
		stopwatchvalue.Parent.Visible = false
		script.Parent.Parent.Visible = false
		
		
	end
end)

When you hit the checkpoint:

local lap = script.Parent.LapCounter.LapNumber
local bool = script.Parent.Parent.Parent.Bools.AllowedToAdvance
local endrace = script.Parent.Parent.Parent.Bools.AllowedToEndRace

game.ReplicatedStorage.Advance.OnClientEvent:Connect(function()
	if script.Parent.RealLapCounter.LapNumber.Value == 1 or 2 then
		bool.Value = true
		script.Parent.LapCounter.LapNumber.Value = script.Parent.LapCounter.LapNumber.Value + 1
	elseif script.Parent.RealLapCounter.LapNumber.Value == 3 then
		endrace.Value = true
		script.Parent.LapCounter.LapNumber.Value = script.Parent.LapCounter.LapNumber.Value + 1
	else
		print("You silly goose! You cannot advance. ")
	end
end)

When people get a value:

game.ReplicatedStorage.Advance.OnClientEvent:Connect(function()
	script.Parent.AllowedToAdvance.Value = true
end)

game.ReplicatedStorage.EndRace.OnClientEvent:Connect(function()
	script.Parent.AllowedToEndRace.Value = true
end)

If you can help, please let me know. Thanks, WE

Something to add, If I can get this to work, finishing Grand Prix and Online Races will be pretty easy!

Maybe because you’re using the same remote event for every map?

I think you should add a part that they will hit when they teach the checkpoint make sure the part is on the checkpoint. Then add a folder named checkpoints.
This well this will help.
https://www.roblox.com/library/5137799093/Car-Race-System

Change some things around so that you can not get copyrighted.

in the first if statement, you check:

if script.Parent.Parent.Parent.Parent.Bools.AllowedToAdvance.Value == true

then you do in an elseif:

if script.Parent.Parent.Parent.Parent.Bools.AllowedToAdvance.Value == true

you need to change the elseif statement check to false instead of true.

No he doesn’t, one of them says AllowedToEndRace and the other is AllowedToAdvance.

oopsie, my bad
thanks for the catch xD

I dont know if its related to your issue or not but

if script.Parent.RealLapCounter.LapNumber.Value == 1 or 2 then

I think you need to check it twice. I Think, that the “or 2” is a completely separate condition and not if Lap is equal to 1 or 2

if Lap.Value == 1 or Lap.Value == 2 then

I have figured it out. Sadly no one got it.

What was it? 30 stm chars here