Time Tracking Script
Customize your variables, then fill in the blanks!
Your Custom Settings
Leaderboard stat for fastest time
Server Script (ServerScriptService)
This script tracks lap times and fastest times. Create "StartTimeEvent" and "EndTimeEvent" RemoteEvents in ReplicatedStorage.
local repStore = game:GetService("ReplicatedStorage")
local startTimeEvent = repStore:WaitForChild("StartTimeEvent")
local endTimeEvent = repStore:WaitForChild("EndTimeEvent")
local startingTime = 0
function GetStartingTime()
startingTime = ()
end
startTimeEvent.:Connect(GetStartingTime)
function GetFinishingTime(localPlayer)
if startingTime == 0 then return end
local currentLapTime = () -
startingTime = 0
local plr = game.Players:FindFirstChild(localPlayer.Name)
local plrStats = plr:WaitForChild("leaderstats")
local fastestTime = plrStats:FindFirstChild("Fastest Time")
if currentLapTime fastestTime. then
fastestTime.Value = currentLapTime
end
end
endTimeEvent.OnServerEvent:Connect(GetFinishingTime)
