function MakeWeld(x,y,type,s)
if type==nil then type=“Weld” end
local W=Instance.new(type)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
W.Parent=x
if type==“Motor” and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA(“BasePart”) then
MakeWeld(b,a,“Weld”)
elseif a:IsA(“Model”) then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
car = script.Parent.Parent.Parent
misc = car:WaitForChild(“Misc”)
The script?
Yeah, that works too, if a script is doing the welding then its a scripting support problem. Also, the workspace explorer is a good idea to pair along with the script.
also be sure to put three back ticks ``` before and after the script on your keyboard to format scripts like below:
local MiscWeld = {}
function MakeWeld(x,y,type,s)
if type==nil then type=“Weld” end
local W=Instance.new(type)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
W.Parent=x
if type==“Motor” and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA(“BasePart”) then
MakeWeld(b,a,“Weld”)
elseif a:IsA(“Model”) then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
car = script.Parent.Parent.Parent
misc = car:WaitForChild(“Misc”)
Hold on, i’ll upload a gif of what I think your weld script is doing and edit this post.
This is what happens when a script creates a weld with the old Roblox welding system for part0 and part1:
As seen the parts tend to go to the same position as the part0 unless the script edits the C0 joint CFrame which it might fail when spawning the car into the game as some parts of the game hasn’t finish loading in yet.
Might be better to use a weld script like in moon Animator which does it automatically for a model.