How to Disable Decimals?

How would i Stop showing decimals in my Studs above Gui?

My script :

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local RunService = game:GetService("RunService") -- Gets one of my favourite services, RunService. This lets us fire functions every frame!

local ui = script.Parent
local text = ui:WaitForChild("TextLabel")
local RootPart = character:WaitForChild("HumanoidRootPart")

	local RootPartStuds = RootPart.Position.Y
	text.Text = RootPartStuds.." Studs"


You’d have to round it. If you don’t care about it rounding to the nearest integer you could just use math.floor. But if you want it to be rounded use math.floor(RootPartStuds+.5).


Is there an article that explains how to do that?, I’m not very good at doing that functions

The only article is the wiki page for math operations/functions. math.floor is a function that turns a double/float to an integer but it doesn’t round, so people do math.floor(double+.5) to round it up manually.

1 Like

What math.floor does is round up a number, for example, if a number is 15.7 it will be 16, if it is 15.3 it will be 15

1 Like

Your thinking of ceiling, floor rounds down. For example, if you called floor on 15.7, you’d get 15 and on 15.3, you’d also get 15. If you called ceiling on both of them you’d get 16.


And they are also thinking of math.round()

1 Like

No, math.floor does not do that unfortunately. Floor (bottom) always rounds down, regardless of the decimal… even if it is .999. math.ceiling rounds up, hence “ceiling” is up.

math.round automatically does what you are thinking of.

1 Like

In order to accurately remove the decimal from the stud number, you can use math.round(). Alternatively, if you simply want to remove the decimal WITHOUT rounding, you can use math.floor()

The process is simple. All you would have to do is the following:

local RootPartStuds = math.round(RootPart.Position.Y) -- or math.floor
1 Like

I wasn’t understanding much since I’m not good at math haha, this should fix it, thanks for helping me

No worries. Good luck with your project and let me know if any further help regarding this issue is needed.

1 Like

I’d recommend multiplying by 10 beforehand and then dividing by 10 afterwards that way using the screenshot provided the studs label would display “16.1”, rounding to the nearest integer might be too harsh/significant of a change (you could be off by a magnitude of 0.5 either way).