Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make a leaderstat that features your highest value on another leaderstat?

Hello!

I'm working on a game where I have two leaderstats, TimeAlive and TopTime. I already have the TimeAlive figured out, but I'm wondering how I can make the TopTime. Does anyone know how I can do this?

2 answers

Hey, your problem can be solved simply by putting

TopTime.Value = tick()

this should work for time but I am not sure, I don't usually make time leaderstats.

4 comments

0

When I put that, it just automatically made the TopTime value 1.6B value...

0

You need to add wait(1)

0

Still doesn't work.

0

do tick(1) sorry

Well i don't know how your architecture looks like so the answer might not be as like you needed but here is example of how to do it with simple variables:

local CurrentTime = 0
local MaxTime = 0

while true do
	wait(1)
	CurrentTime += 1
	if CurrentTime > MaxTime then
		MaxTime = CurrentTime
	end
end

Basically you should understand here, CurrentTime is the current time and MaxTime is your highest time. I have put while loop there so the time adds every second and at line 7 it checks if the current time is higher than your highscore time then it will set the MaxTime to the CurrentTime.

This discussion is preserved as it was. New answers, comments, and votes are closed.