Best time script not working

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")

	if aliveTime.Value >= bestTime.Value then
		bestTime.Value = aliveTime.Value

	aliveTime.Value = 0

while wait(1) do
	if humanoid.Health == 0 then

	aliveTime.Value += 1
1 Like


The script you provided works, though you should put it in StarterCharacterScripts (not StarterPlayerScripts).


1 Like

If you actually meant to say startercharacterscripts, there’s most likely another script interferring with your BestTime value.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.