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

Avoiding GUI Roundoff Error wth Big Numbers?

Asked by 6 years ago
Edited 6 years ago
num = "45.67e+35"
modifiednum = string.format(".0f", num)
for _,p in pairs(game.Players:GetPlayers()) do
    p.PlayerGui.ScreenGui.TextLabel.Text = modifiednum
end

Why is this giving me roundoff error? It's supposed to give me the number without any decimal points.

1 answer

Log in to vote
1
Answered by 6 years ago

You can round down:

print(math.floor(4.8)) -- prints 4

Not sure how to round up tho

0
You can use math.ceil to round up Amiaa16 3227 — 6y
Ad

Answer this question