Hi,

I’m currently working on a script that devides the player count by two, but I don’t know how to devide an odd number without the decimal place in each number.

E.g.:

I get: 5 / 2 = 2.5

But I want: 9 / 2 = 2 and 3

Does anyone know how to solve this?

2 Likes

You can use a symbol cant remember the name but it looks like a sideways percent

2 Likes

Lemme try and find the name rq

2 Likes

Hey there!

First of all, this topic belongs in #help-and-feedback:scripting-support .

As to your problem, there are three functions that could solve your problem. These are: math.floor, math.ceil, and math.round.

Here’s what each does:

Floor: Lower a decimal to whole number (ex. 1.75 → 1)

Ceil: Raise a decimal to whole number (ex. 1.25 → 2)

Round: Rounds the decimal to the nearest whole number (ex. 1.5 - > 2)

Hope this helps!

2 Likes

More info. Its the thing you use when you factor stuff. Ex: if the number is divisible by two (print) its even. Else print its odd. (instead of divisible put the other symbol I cant find ;-; )

2 Likes

another correction ( : P ) it looks like a 0 / 0 but its straight

2 Likes

```
local lower = math.floor(5/2) -- 2
local upper = math.ceil(5/2) -- 3
```

4 Likes

Change this post’s name to “Divide an odd number”…I noticed a typo.

1 Like

It’s the modulo operator, and it’s just a normal percentage symbol. For this case, as others are saying, the solution would be flooring or rounding the number

1 Like