PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Position

BasePart

Vector3

The Position property describes the coordinates of a part using a Vector3. It reflects the position of the part’s /BasePart/CFrame, however it can also be set. When setting Position, overlap checking takes place: if moving the part would cause it to overlap with another part, the destination position shall be just high enough so no overlap occurs. To avoid this, set the part’s /BasePart/CFrame instead.


Code Samples


Position Overlap Checking

This code sample demonstrates the overlap checking behavior of the Position property by creating two parts, PartA and PartB. It attempts to place them at the same Position.

-- Create two parts, PartA and PartB
local partA = Instance.new("Part", workspace)
partA.Name = "PartA"
partA.BrickColor = BrickColor.new("Really red")
partA.Anchored = true
local partB = Instance.new("Part", workspace)
partB.Name = "PartB"
partB.BrickColor = BrickColor.new("Really blue")
partB.Anchored = true

-- Demonstrate overlap
partA.Position = Vector3.new(0, 50, 0)
partB.Position = Vector3.new(0, 50, 0) -- This would cause an overlap!
print(partB.Position == Vector3.new(0, 50, 0)) --> false
print(partB.Position) --> Very close to (0, 51.2, 0)