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

[Solved]Why is this script displaying incorrectly on the leaderboard with the wrong letter?

Asked by 5 years ago
Edited 5 years ago

Here is the code there are no errors:

    money.Changed:Connect(function()

        if money.Value >= 10 ^ 3 then

            if string.len(tostring(money.Value / (10 ^ 3))) > 3 then

                cash.Value = string.sub(tostring(money.Value / (10 ^ 3)), 1, 3).."K+"

            else

                cash.Value = string.sub(tostring(money.Value / (10 ^ 3)), 1, 3).."K"

            end

        elseif money.Value >= 10 ^ 6 then

            if string.len(tostring(money.Value / (10 ^ 6))) > 3 then

                cash.Value = string.sub(tostring(money.Value / (10 ^ 6)), 1, 3).."M+"

            else

                cash.Value = string.sub(tostring(money.Value / (10 ^ 6)), 1, 3).."M"

            end

        elseif money.Value >= 10 ^ 9 then

            if string.len(tostring(money.Value / (10 ^ 9))) > 3 then

                cash.Value = string.sub(tostring(money.Value / (10 ^ 9)), 1, 3).."B+"

            else

                cash.Value = string.sub(tostring(money.Value / (10 ^ 9)), 1, 3).."B"

            end

        elseif money.Value >= 10 ^ 12 then

            if string.len(tostring(money.Value / (10 ^ 12))) > 3 then

                cash.Value = string.sub(tostring(money.Value / (10 ^ 12)), 1, 3).."T+"

            else

                cash.Value = string.sub(tostring(money.Value / (10 ^ 12)), 1, 3).."T"

            end

        else

            cash.Value = string.sub(tostring(money.Value), 1, 3)

        end
    end)

cash is a stringvalue in the player which displays on the leader board. money is a value in serverstorage.

0
You're asking why there's no errors? T1mes 230 — 5y
0
is money.Value a string if so, don't make it a string! terence404 19 — 5y
0
The script is not displaying the money amount correctly. money.Value is a number value. User#21908 42 — 5y
0
I want the leader board to display a string value User#21908 42 — 5y
View all comments (4 more)
0
Its just displaying the wrong number along with the wrong letter User#21908 42 — 5y
0
Are you able to show the variable "money" GroovyFhish 8 — 5y
0
? User#21908 42 — 5y
0
I think it has something to do with the division but I don't know how to fix it User#21908 42 — 5y

Answer this question