Keeping parts welded together

 	if v:IsA("BasePart") then
 		local weld=Instance.new("Weld", v)
 		weld.Part0=v
 		weld.Part1=script.Parent.MainPart
 		weld.C0=v CFrame:inverse()
 		weld.C1=script.Parent.MainPart.CFrame:inverse()
 		v.Anchored=false
 	end
 end

I’ve tried to weld 3 parts together so I can make an onTouch script (i get the ontouch part i just dont know how to weld 3 parts).

I wanted to keep these 3 parts together

, but when test it out it ends up like this image
but when test it out it ends up like this
(upload://iGjGHaeiDKtLvxoh2meRHnVECDY.png)

The main part is the truss, partA is the red block, and partB is the grey part (which is connected to a hinge)

If anyone needs more information just respond or contact me via discord, my user is Heywood Jablowmee#3732

Thanks!

2 Likes

Hey there!

I suggest using this really neat Welding Plugin!

Here you go

I am not the owner of the plugin credits for this plugin goes to the owner, Ozzypig.

I really hope this helped…

2 Likes

Instead of having to script it, just use the WeldContraint tool found in the model tab,
Documentation:

1 Like

The properties of C0 and C1 are not really necessary for current usage area. You can simply put welds without filling the C0 and C1 properties.

You can test the WeldConstraint object as an alternative.


Do not use the second parameter of Instance.new(), as the reason behind it is written on a PSA here:

2 Likes

Thank you everyone for the suggestions but I’m going to have to go with the simpler one here since I’m trying to make my game as organized as possible, but thank you all for your suggestions! :smiley:

3 Likes