So you know if you put a text button inside a frame GUI then where ever the frame is the text button will be in the same position. I am trying to do that but with parts not gui’s so I am wondering if I could use align position but I don’t know how so if any of you know a solution it would be greatly appreciated.
Yeah, should be really easy even. Just put one in the Part you want to be get aligned and leave the default settings. The hard/confusing part is getting the Attachments set up right. You’ll need an Attachment in both the aligned parted and the aligner part. In my opinion, you should set it up so that you can control where the bottom of the aligned part ends up, because if you want it above the character or whatever else, you’re more likely to care about the gap between the character and the aligned part, and not where the center of the aligned part ends up. So move the aligned part Attachment so that it is exactly at the bottom of the aligned part, and move the aligner Attachment so that it is where you want the bottom to end up.
It should just work if you do it like this. You might want to tune some of the parameters of the AlignPosition like responsiveness, or you could even set Rigidity Enabled to true, that should cause it to align the positions as hard as possible.
You’ll probably want an AlignOrientation as well, otherwise the aligned part will just be flopping around.
One other thing, if you really want it to be exactly like a billboardgui but with parts, you might not want to use body movers / physics constraints at all, and instead just update the CFrame every RenderStepped. The only reason to use physics constraints is if you want a “physics-ey” feel, where it’s got some momentum instead of just snapping perfectly to the right spot.
I am using it so that I have a part with values in it that hold the position of where the other parts should go inside of it so that when you click a button it puts that part in the position how do I do that with your method or am I overthinking this?
Not really, the idea of having an object that holds the position information for the aligned part is really good, but using a Vector3Value for it is not the simplest way of doing it. Since you need 2 Attachments to set up the AlignPosition anyway, you could just as well use an Attachment to store the position information. This has the added bonus that you can use studio tools to move Attachments around and visualize them, which you can’t do with Vector3Values. If you used Vector3Values, then any time you want to set up the AlignPosition you’d need to create a new Attachment and set its Position to be the same thing as the Vector3Value.Position, so it’s just additional unnecessary work and complexity.
Im confused with how to set that up I have never really used align position so I am not sure how to do that
No problem. The AlignPosition needs to be a descendant of whichever worldroot you’re working in, which in this case means game.Workspace. That means it doesn’t need to be a child of either the aligned part or the aligner part! But it’s usually cleanest to put it into the aligned part.
It needs two attachments, Attachment0 and Attachment1. These attachments must be direct children of the parts you want to be aligned and aligner. The parent of Attachment0 will get moved to align the position with the parent of Attachment1.
AlignPosition doesn’t align the Positions of the parts. Instead they take into account the position and orientation of the two attachments, making it so that they end up at the same world-space coordinate. Attachments follow their parts, both in terms of position and orientation. Put an attachment into a Part, offset the attacment, and move and rotate the part around to understand this. You can visualize attachments by enabling constraint details, and also enable draw on top.
To set it up like I explained, make it so the attachment inside the aligned part is positioned right at the bottom face of the aligned part. Then make the aligner attachment somewhere above the head of the character, or whatever else you want the aligned part to appear above. If you set AlignPosition.Attachment0 to the aligned part attachment, and Attachment1 to the aligner part attachment, you should see it working as expected.
this is perfectly explained but when I try to select attachment0 and 1 it does not work it just shows it as blank
Edit:Nevermind I got it
I am sorry I just got so lost I’m trying to make it so that wherever I move one part the part inside of it has the same position no matter where its parent is so that its position is always relative to its parent meaning like a GUI the inside part never changes no matter where its parent is moved. Your explanation is great but there must be an easier way to do this because I don’t understand how this all works together. Sorry to bother you but I have only been scripting for a year now and you’re saying there’s no other way to do this?
Ehhh if you just want the parts to keep their relative position constant, you can use a Weld or WeldConstraint for that.