Leaderstats round strings

I’m not sure if this is a bug or a feature, but a number stored in a StringValue shows up simplified on the ingame leaderboard. Is there a way I can keep my decimal? :confused:

This isn’t a bug. This is a feature of Lua.
Lua auto-converts between strings and numbers. For example: print("5" + 6)

4 Likes

This is the most beautiful thing I’ve ever read.

5 Likes

If you want to specify number formatting, use StringValues and string.format:

print(string.format(“%.1f”, 5))
→ 5.0

2 Likes

Oh neat, thanks

What you said sounded beautiful indeed.

More on-topic though:
If his StringValue actually has the value “5.0” it would be my fault.
With the whole “sorting 2 different values errors” it uses tonumber() now.

I could make it that it sorts numerical, but displays the original text.
(I would have to make a Pull Request, so it takes time to be accepted and more time to be uploaded)

EDIT: I feel like I should’ve replied to @Haggie125 and @Seranok too, 3 at once.