← Back to Racing Scripts

Lap Counter Script

Customize your variables, then fill in the blanks!

Your Custom Settings

Must match leaderboard stat
RemoteEvent in ReplicatedStorage

Server Script (ServerScriptService)

This script counts laps when the LapEvent is fired. It uses a debounce to prevent counting too fast.

local repStore = game:GetService("ReplicatedStorage")
local lapEvent = repStore:WaitForChild("LapEvent")
function (localPlayer)
    local plr = game.:FindFirstChild(localPlayer.)
    local plrStats = plr:WaitForChild("")
    local plrLap = plrStats.Laps
    plrLap. 1
end
lapEvent.:Connect(incrementLapCount)