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

How do I make a Miners Haven leaderboard?

So I was making a leaderboard the other day, and I wanted to add letters to it, like in Miner's Haven. I tried 3 different times:

if cash.Value == 1000 then cash.Value = "1k" end

if player.cash.Value == 1000 then player.Cash.Value = "1k" end

if player.cash.Value >= 1000 then player.cash.Value = "1k"

Could someone help me figure this out? Thanks.

1 answer

You're probably trying to change an IntValue's value to string which will return an error. What you need to do is create a StringValue and make the other cash value off the leaderboard (not in leaderstats). When comparing you will need a code like this:

while wait() do -- Start a loop to keep it updating
	if numberCash.Value >= 1000000 then -- Check if the IntValue is more than 1000000
		stringCash.Value = string.sub(tostring(numberCash.Value),1,1).."M" -- Get the first number and put M after it.
	end
	if numberCash.Value >= 100000 then -- Check if the IntValue is more than 100000
		stringCash.Value = string.sub(tostring(numberCash.Value),1,3).."K" -- Get the first three numbers and put K after it.
	end
	if numberCash.Value >= 10000 then -- Check if the IntValue is more than 10000
		stringCash.Value = string.sub(tostring(numberCash.Value),1,2).."K" -- Get the first two numbers and put K after it.
	end
	if numberCash.Value >= 1000 then -- Check if the IntValue is more than 1000
		stringCash.Value = string.sub(tostring(numberCash.Value),1,1).."K" -- Get the first number and put K after it.
	end
end

NOTE: The script I gave you will only work with numbers up to 1 million. You will have to add more to make it work with bigger numbers.

If this worked for you or helped you, please like and accept this as the answer.

1 comment

0

Please refrain from answering spam and not-constructive questions by giving them a whole script. Before posting an answer, please read this: https://scriptinghelpers.org/help/how-post-good-questions-answers

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