Auto Updating Stats

Hello! I want to make a system/script that will auto-update player’s run record like speedrun etc, and I want it to show up on the leaderboard, for example, a player finished speedrun in time I want that time to show up but after that player finishes the run. but the problem is I tried using stuff I thought would work, I tried to use auto-updating script when you reset it updates your stats but it only updated group rank, etc.

Script that I used
1. game:GetService('Players').PlayerAdded:Connect(function(player)
2. player.CharacterAdded:Connect(function(character)
3. character:WaitForChild("Humanoid").Died:Connect(function()
4. print(player.Name .. " has died!")
5. end)
6. end)
7. end)

1 Like

what kind of stats are you using? if its under the player, you can do something like this.

game:GetService('Players').PlayerAdded:Connect(function(player)
 player.CharacterAdded:Connect(function(character)
 character:WaitForChild("Humanoid").Died:Connect(function()
 local Time = "whatever time they got"
local PersonalBest = player.PersonalBestTime.Value
if Time < PersonalBest then
PersonalBest = Time
else
print("Did Not Beat Their Personal Best")
 end)
 end)
end
 end)
1 Like

Where should I put this? a normal script in Workspace right?