Hello.
So I have a model that has a part that is welded to a base part. (C0 - basepart, C1 - part)
When I do weld.C0 = CFrame.Angles(math.rad(90), 0, 0)
the part does rotate but teleports far away from the base part. None of wiki pages helped me. I tried using CFrame:inverse()
but that did not help at all. I tried using Motor6D
but effect is the same: part is teleported away. I also tried switching C1 and C0 but that did not help either.
Any help is highly appreciated!
He posted a model in the chat, so this is based on that.
-- Taken from free models, cause yours wasn't working right. local all,last = {} function scan(p) for _,v in pairs(p:GetChildren()) do if (v:IsA("BasePart")) then if (last) then local w = Instance.new("Weld") w.Part0,w.Part1 = last,v w.C0 = v.CFrame:toObjectSpace(last.CFrame):inverse() w.Parent = last end table.insert(all,v) last = v end scan(v) end end scan(script.Parent) for _,v in pairs(all) do v.Anchored = false end
Your second script, I reccomend using a RemoteEvent to fire after the weld script is done, so you don't have to wait 2 seconds. That or just put this part after the for loop in the weld script.
wait(2) local base = script.Parent:WaitForChild('Base') local weld = base:WaitForChild("Weld") weld.C0 = CFrame.Angles(math.rad(90), 0,0)