✓ Accepted answer
Generally with this kind of problem I suggest an array. Then use a function to loop through the array and see if the item is in that array. Here is an example:
local specialRounds = {
10,
20,
30,
40,
50
}
local function checkRound(currentRound, rounds)
for i,v in pairs(rounds) do
if currentRound == v then
return true
end
end
return false
end
local round = 30
if checkRound(round, specialRounds) then
end
If you are wanting to only check if the round is a multiple of ten than you can simply use the modulus % operator. It will divide the number by whatever number you choose and return the remainder. This means that if you have a remainder of 0 the number is divisible by ten. Here is an example:
local currentRound = 15
if currentRound % 10 == 0 then
end
I hope this helps and have a great day scripting!
Edit:
What theking48989987 was going for was incrementing by ten. I just wanted to clarify so that people understood his method a little better. I will also use a function so that it can be used as many times as you might want. Example of method:
local highestLevel = 100
local function checkRound(currentRound, maxLevel)
for i = 10, maxLevel, 10 do
if currentRound == i then
return true
end
end
return false
end
local currentRound = 20
if checkRound(currentRound, highestLevel) then
end
I hope this helps clarify what he meant. Have a great day scripting!
3 comments
There is a better way. Check out my answer.
Uh... Has anyone heard of a step? The third optional parameter of the neumeric for loop? for i=0, 1000, 10 do print(i) end
:p