Class - Attachments
An attachment is an object that references position and orientation relative to its parent.
An important reminder is to NOT USE SCRIPTS OFTEN for these in cases of rotation using tweens, and rotation in general
because it makes the thing you are making unoptimized, laggy, and in some cases not turn the way you want to. (usually in rotation)
This tends to happen with tweens due to the rotation stuff.
Attachments can parented to these usually during VFX:
- Baseparts (Parts, Unions, Meshparts, etc.)
- Other Attachments (please note that this is relative to its parent's attachment!)
A weird thing that I don't like about attachments is that it can't be a child of certain items.
These include:
- Models (A group of items. Use CTRL+G)
- Folders (A model but when you select it, it doesn't select the whole thing. Use CTRL+ALT+G)
- Scripts (The scripting/coding part of Roblox Studio)
The main items that are children of attachments are usually particle emitters and sometime scripts.
Behavior
Many items use attachments to work or will have special effects when parented to an attachment. Here are some items that use attachments.
- Most constraints: These constraints usually have a attachment 1 and 0. These use the attachments to work.
- Beams: These use attachments to work from start to end. These will have more later. These also have attachment 1 and 0.
- Particle Emitters: Upon being parented to an attachment, the particles will emit from the attachment at one point.
- Sounds: The point where the sound comes from will be the attachment.
- Lights: The lights will come from the attachment.
Properties
- CFrame: The CFrame of the attachment. In CFrame
- Orientation: Rotation of the element. In Vector3
- Position: Position of the attachment relative to its parent. In Vector3.
- Visible: Whether the attachment is visible. In a boolean (true/false)
- World CFrame/Orientation/Position: The same things as above but relative to the world.
Methods
- GetConstraints(): Gets all constraints that use the attachment. Returns a table.
Beams
A beam is a texture that can move from one point to another. These are used in advanced VFX but can suffer from major z-fighting issues.
These can be used in a variety of uses, such as rings and whatnot. These are not to be mixed up with trails.