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

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

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

✓ Accepted answer

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. 

2 comments

0

Thank you!

0

Actually, when I put a C1 it bugged my weld, sorry.

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