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

How can I find the next multiple of 5 from a number?

Asked by 5 years ago

I assume I could just round and look for the next number that isn't a decimal, but I'm sure there is a more optimized and better way to do this.

Say I have a player load in with the number 6 How can I find the next multiple of 5 (which is 10)

1 answer

Log in to vote
0
Answered by
jaschutte 324 Moderation Voter
5 years ago
Edited 5 years ago

(I'm using mobile sorry for typing mistakes)

local x = 6
local next5 = math.ceil(x/5)*5 -- x is the number, in your example x = 6
print(next5) -- prints out 10

This should do it! Hope it helped!

Ad

Answer this question