Is there any math function or method anybody could share? Just a simple question, sorry if it’s an inconvenience.
Just take the number or variable and divide by 2. Say the variable is X
variable = (X + 16)/2
local Number = x / 2 print(Number)
Change x to your number.
Just use the
num /= 2
That’s not necessary, because all you need to do is divide the number. The print will return the answer. (He was asking how to half a number.)
You mean the divide sign isn’t necessary?
This is what I mean to use. It will divide the number, then print it.
Oh okay, makes sense. Is there any method to do this with players?
local Players = game:GetService("Players"); local AmountPlayers = #Players:GetPlayers(); local HalfPlayers = math.floor(AmountPlayers / 2 + .5); print(AmountPlayers, HalfPlayers);
What do you mean by with players?
Halfing a player count, like what is displayed above.
math.round() to estimate the half amount in case you want to exclude any decimals (
.5, etc), otherwise you can just do
print(Num / 2)
local function HalfNumber(Num) print(math.round(Num / 2)) end HalfNumber(384.2938473) -- Should output back as 192