Let’s say I do this:
for i,v in pairs(game.Players:GetChildren()) do
-- Detect whether "i" is even or odd
end
How would I find if “i” is even or odd?’
Thanks in advance!
EDIT: This is probably so easy but I can’t think rn
Let’s say I do this:
for i,v in pairs(game.Players:GetChildren()) do
-- Detect whether "i" is even or odd
end
How would I find if “i” is even or odd?’
Thanks in advance!
EDIT: This is probably so easy but I can’t think rn
Divide i with 2. If the result is a whole number, it is even; otherwise, it is odd (decimal).
Note: @JigglyWiggles’s solution is much more efficient.
Modulus operator.
if i % 2 == 0 then.
maybe have to play around, I might have it wrong. If you give me a few I can test it.
Edit: this is right. If it’s even it will equal 0.