How to round up a vector3 value and use it in a textlabel?

I am currently working on a cordinate system where it says the position of the charcter on a text label and that works, but the problem is that when I get the position of the Character/HumanoidRootPart then there is alot of decimals.

Example: XYZ: 874.237536435435, 205.345346345, -1481.35353634.

So the thing I wanna accomplish is that it whould say XYZ: 874.2, 205.3, -1481.3. I have tryed to look for other with the same problem and tried to use some scripts to round up the numbers but couldent figure out how to round it up like I wanted to.

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild(“HumanoidRootPart”)

local MainTxtL = script.Parent – if you didn’t put the script inside here, this would be slightly different

while true do
local pos = root.Position

print(player.Name, "is at", pos)
MainTxtL.Text = "XYZ: " .. tostring(pos)
task.wait(4)

end

(This is all in 1 script I just forgot how to make the boxs together)
(The script is a localscript)

Thanks for all the help!

You can just do

local Coordinates = "XYZ: "..pos.X.." "..pos.Y.." "..pos.Z --making this into a string allows you to put it anywhere
print(Coordinates)
1 Like