(Please Answer) How do I weld a part without changing its position at all, while using a weld instance

Ive went on many many devforums, never got a answer to any.

Im trying to weld a part to another part using a “Weld” Instance.
I know it involves a lot about offsets, and im wondering, how do i get that offset?

In short terms, im trying to weld a part to another part, without changing its position.
Like how moonanimator has the Join In Place weld feature.

Code:
image

What im expecting:
(barrel is infront of gun)
image

What i get:


(the barrel moved to the middle of the gun)

Just saying, if you provide a solution your helping out MANY people who dont know how to do this.

2 Likes

When creating a new weld, ensure that the original position is cloned along with it.

You can move the barrel back to its original position after welding

How do i do that, i have tried doing this with cframe but that doesnt work, do i just do it with position instead?

I store the original cframe, and put it back to that cframe, but it doesnt work.

You can attach an object to the player’s hand by creating an attachment, and then assign the attachment to the C0 property of the new weld.

u can simply change the position of the barrel

barrel.Position = Barrel_Pos  --position to original barrel position

That won’t work; only the barrel will end up moving. You need to move the CFrame.

Oh, in that case;

local ORIGINAL_POS = weld.Position -- Replace "weld" with your weld.
NewWeld.Position = ORIGINAL_POS

Will try that, ill update you in a minute or so.

Ooh, thats not exactly what i mean.

Listen let me clarify here.

Im trying to mess with the C0 or C1 to make part1 be in the exact same position it was before
Im trying to use only position and CFrame, because im trying to do something weird, like a insert thing.

I dont exactly have a pre-written weld position on the new part im trying to weld it to, thats why.

Yeah, this is your best bet. (Referring to the message I replied to.)

sorry, I meant this message right here ^^

So i cant do no math or anything to figure out the old position but with C1?, nothing like pointtoworldspace() or something?

You can do

Local NewCFrame = [old cframe]:ToObjectSpace([whatever your weld is parented to])
Weld.[c1 or c2, depends on what you want to change] = NewCFrame

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.