Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When I added a weld and scripted it, it won't work?

Asked by 4 years ago
Edited 4 years ago
local Model = script.Parent
    local Main = Model:WaitForChild('Main')
    local OtherPart = Model:WaitForChild('Part')
local parts = Model:GetChildren()
for i = 1, #parts do
   if ((#parts[i].ClassName == 'Part')) then
      local Weld = Instance.new("Weld",Main)
      Weld.C0 = Main.CFrame:inverse() * OtherPart.CFrame
      Weld.Part0 = Main
      Weld.Part1 = OtherPart
   end
end

I was trying to make a weld part for my new cafe but when I tried to make it, it didn't work?

1 answer

Log in to vote
0
Answered by
Farsalis 369 Moderation Voter
4 years ago
Edited 4 years ago

So it might be, your affecting the offset for C0 aka Part0, but, when you set Part1, your not setting an offset for C1 aka Part1. Try the code below, and play with it for whatever works for what your doing.

Weld.C1 = OtherPart.CFrame:inverse() * Main.CFrame -- Or whatever, you think is appropriate. 
0
Thank you! ISkyLordDoge 37 — 4y
0
Actually, when I put a C1 it bugged my weld, sorry. ISkyLordDoge 37 — 4y
Ad

Answer this question