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