Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How do I make a Miners Haven leaderboard? [closed]

Asked by 9 years ago

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.

Closed as Not Constructive by LetThereBeCode, Azmidium, ChemicalHex, General_Scripter, and Perci1

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
-1
Answered by 9 years ago

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.

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 LetThereBeCode 360 — 9y
Ad