Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Making welds with rotation?

I have this sphere like ball made with parts that are rotated and cframed. Is it possible to weld them all together without removing its rotation?

all=Workspace.Model:getChildren()
for a=1,#all do
	if all[a]:IsA("BasePart") and all[a].Name=="Holder" then
		holder=all[a]
	end
end
for a=1,#all do
	if all[a]:IsA("BasePart") and all[a].Name~="Holder" then
		local weld=Instance.new("Weld",all[a])
		weld.C0=all[a].CFrame--+all[a].CFrame.Angles
		weld.Part0=all[a]
		weld.C1=holder.CFrame
		weld.Part1=holder--+holder.CFrame.Angles
	end
end
for a=1,#all do
	if all[a]:IsA("BasePart") then
		all[a].Anchored=false
	end
end

Before script runs.. postimg.org/image/y90gh2b1v/ After script runs.. postimg.org/image/55c8ktmyb/

1 answer

✓ Accepted answer

Replace line 09-13 with this:

	local weld = Instance.new("ManualWeld",all[a])
	weld.Part0 = all[a]
	weld.Part1 = holder

	weld.C0 = weld.Part0.CFrame:inverse()
	weld.C1 = weld.Part1.CFrame:inverse()

I've only learned this recently, but ManualWelds seem to be able to weld objects that are not anchored.

If you use a normal Weld, and the parts are un-anchored, the cframes get messed up.

2 comments

0

All welds do not function if any of the parts joined are anchored. They only work if both parts are un-anchored. The reason the cframes get "messed up" is because you do not use the C1 property correctly.

0

This answer helped the issue. Thanks.

This discussion is preserved as it was. New answers, comments, and votes are closed.