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

Avoiding GUI Roundoff Error wth Big Numbers?

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

You can round down:

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

Not sure how to round up tho

1 comment

0

You can use math.ceil to round up

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