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
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:
https://developer.roblox.com/en-us/api-reference/class/WeldConstraint
1 Like
Operatik
(Operatik)
July 24, 2019, 9:02pm
#4
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:
I’ve discovered a pretty bad performance issue in one of top games that has to do with Instance.new and wanted to write about this, since this is not obvious unless you know the system inside out.
Tthere are several ways to create a ROBLOX object in Lua:
local obj = Instance.new(‘type’); fill obj fields
local obj = Instance.new(‘type’, parent); fill obj fields
local obj = util.Create(‘type’, { field1 = value1, … })
If you care at all about performance, please only use the first option - I wi…
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!
3 Likes