Why use Attachment?
An Attachment provides a local coordinate frame relative to its parent. Beams, forces, and many constraints use attachments to know where an effect or joint begins.
Try it in Roblox Studio
Put a Part named AnchorPart in Workspace and this Script in ServerScriptService. Move the part in Studio and compare the attachment’s local Position with WorldPosition.
Syntax
attachment.Position = Vector3.new(0, 2, 0)Examples
Attachments
Place an attachment two studs above its parent part origin.
local part = workspace:WaitForChild("AnchorPart")
assert(part:IsA("BasePart"))
local attachment = Instance.new("Attachment")
attachment.Name = "TopPoint"
attachment.Position = Vector3.new(0, 2, 0)
attachment.Parent = part
print(attachment.WorldPosition)- Position is measured in the part’s local space, so it moves with the part.
- Parenting to a BasePart gives the attachment a world-space position.
- WorldPosition is useful for inspection; effects and constraints generally reference the Attachment instance itself.
Best practices
- Parent attachments to the intended BasePart before using their world-space properties.
- Use descriptive names for multiple attachment points.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation