Hey, so trying to make a script with a best time and time alive thing I got the time alive part working, and now every second the leaderboard value with Timealive works. although, the BestTime part on the otherhand doesn’t work. Each time I reset, it doesn’t change at all and stays at 0 no longer how long I have been playing / how large my Timealive is.
Script (in starterplayerscripts):
local humanoid = script.Parent:WaitForChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(script.Parent) local leaderstats = player:WaitForChild("leaderstats") local aliveTime = leaderstats:WaitForChild("Timealive") local bestTime = leaderstats:WaitForChild("BestTime") humanoid.Died:Connect(function() if aliveTime.Value >= bestTime.Value then bestTime.Value = aliveTime.Value end aliveTime.Value = 0 end) while wait(1) do if humanoid.Health == 0 then break end aliveTime.Value += 1 end