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/
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.