ZVNE15Z
(49ER_EMPERYAN)
May 6, 2023, 5:59am
#1
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:
What im expecting:
(barrel is infront of gun)
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
ZVNE15Z
(49ER_EMPERYAN)
May 6, 2023, 6:07am
#4
How do i do that, i have tried doing this with cframe but that doesnt work, do i just do it with position instead?
ZVNE15Z
(49ER_EMPERYAN)
May 6, 2023, 6:07am
#5
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
ZVNE15Z
(49ER_EMPERYAN)
May 6, 2023, 6:15am
#10
Will try that, ill update you in a minute or so.
ZVNE15Z
(49ER_EMPERYAN)
May 6, 2023, 6:18am
#11
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.
ZVNE15Z
(49ER_EMPERYAN)
May 6, 2023, 6:18am
#12
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 ^^
ZVNE15Z
(49ER_EMPERYAN)
May 6, 2023, 6:23am
#15
So i cant do no math or anything to figure out the old position but with C1?, nothing like pointtoworldspace() or something?
ZVNE15Z
(49ER_EMPERYAN)
May 6, 2023, 6:40am
#16
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
5 Likes
system
(system)
Closed
May 20, 2023, 6:40am
#17
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.