Any way to find out the Vector3 of a part?

Hello! I have been looking for the Vector3 of a part, but I am unable to.

  1. What do you want to achieve? I want to see the Vector3 of a part to use it in a script.

  2. What is the issue? There is a part of the code that requires the Vector3.

  3. What solutions have you tried so far? I have looked all over the Internet for it, including the Developer Hub.

Help will be greatly appreciated!

Are you looking for size or position?

Position! I will be happy if you can help me!

Replace “Part1” with the name of your part

local position = game.Workspace.Part1.Position
print(position)

I have been using that and it didn’t work for what I need. I’ll show you my code.

while true do
	local posx = tonumber(game.Workspace.Part.Position.X)
	local posy = tonumber(game.Workspace.Part.Position.Y)
	local posz = tonumber(game.Workspace.Part.Position.Z)
	local posxround = math.round(posx)
	local posyround = math.round(posy)
	local poszround = math.round(posz)
	local vector = Vector3.new(posxround,posyround,poszround)
	script.Parent.Position = vector
	wait(.1)
end
2 Likes

The script gets the position of your object just fine. I made two small modifications to demonstrate:

-- Open output to see proof!

while true do
	local posx = tonumber(game.Workspace.Part.Position.X)
	local posy = tonumber(game.Workspace.Part.Position.Y)
	local posz = tonumber(game.Workspace.Part.Position.Z)
	local posxround = math.round(posx)
	local posyround = math.round(posy)
	local poszround = math.round(posz)
	local vector = Vector3.new(posxround,posyround,poszround)
	script.Parent.Position = vector
	print(vector) -- Position (works)
	wait(1) -- Longer "wait"
end