hi i have scripted this global speedrun leaderboard in roblox but it starts the timer as soon as u spawn , how do i make it to start when i touch a brick
This is the script : local ds, lb = game:GetService("DataStoreService"), workspace.Core.Leaderboard.leaderboardUI.mainFrame require(5166391546) local timeData = ds:GetOrderedDataStore("Time") local times = {} local function ToHMS(secs) local mins = (secs - secs % 60) / 60 local hrs = (mins - mins % 60) / 60 secs, mins = secs - mins * 60, mins - hrs * 60 return ("i"):format(hrs)..":"..("i"):format(mins)..":"..("i"):format(secs) end local function updateLB() for _, lbl in pairs(lb:GetChildren()) do if lbl:IsA("TextLabel") then lbl:Destroy() end end local pages, index = timeData:GetSortedAsync(true, 100), 0 repeat local list = pages:GetCurrentPage() for rank, data in ipairs(list) do local txt = script.userText:Clone() txt.Text, txt.Parent = "#" .. rank + index .. " - " .. data.key .. " " .. ToHMS(data.value), lb end if not pages.IsFinished then pages:AdvanceToNextPageAsync() index = index + 100 end until pages.IsFinished end game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function() times[plr] = {["time"] = tick();["newTime"] = false} end) end) lb.list:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function() lb.CanvasSize = UDim2.new(0, 0, 0, lb.list.AbsoluteContentSize.Y) end) workspace.Core.Winpad.Touched:Connect(function(t) local plr = game.Players:GetPlayerFromCharacter(t.Parent) if plr then if (not timeData:GetAsync(plr.Name) or timeData:GetAsync(plr.Name) > math.floor(tick() - times[plr].time)) and not times[plr].newTime then times[plr].newTime = true timeData:SetAsync(plr.Name, math.floor(tick() - times[plr].time)) updateLB() end end end) updateLB()
