How to make a variable output only whole numbers

So well if I have 10/4 I will get 2 not 2.5
I want a variable to represent that.
X = script.Parent.Value
Local Variable = X/4
How do I make X/4 do that

math.floor(2.5) --2

Just floor it?

Do you mean you want to round a number? to round numbers you just use

math.round(2.7) -- 3

if in your example you want to round 2.5 to 2 The mathematical function is math.floor and not round (like @WingItMan said)

What I mean is you have a variable with an unknown value. So If X is 10 it will be 10/4. It will then be 2 since 4 can only go in there twice. Hope this helps.

I don’t see what the issue is?
times = math.floor(x/4)

It will be a variable not an actual number.

your question was answered multiple times the answer is just math.floor

1 Like

It says there is a stack end in the output with that line of code.

Well not quite. I didn’t know you could just throw a variable in there.

What do you mean throw a variable in there

Stack end doesn’t mean anything, it’s just the last line of the output. You probably didn’t define X. If you’re writing a real script you’ll need to include a lot more details when you run into an issue, and in the mean time spend a lot more time messing around. We can’t tell you every little thing about programming, you’ll need to look a the documentation for math.floor and mess around with it.

Like instead of a defined number, 2.5 I have a variable that represents a intvalue that consistently changes.

Alright.
Some empty space I guess.

local X = script.Parent -- don't do .Value yet because if the value changes, it will not use the new value. Use .Value in the variable formula
local variable = math.floor(X.Value)

if you don’t know that then you probably don’t know basics of scripting (no offense

the thing that you said is like saying the next code won’t work

local x = 10

print(x)