Bubu2319
|
  |
| Joined: 06 Aug 2011 |
| Total Posts: 1006 |
|
|
| 16 Mar 2015 11:42 AM |
Hello, what is the best way to group parts and make them stick together without anchors. Basically I want to be able to take a part turn it into a model with another part then move them together all in game. Heres the script I wrote. So should I use welds, joints, or?
--lilBIGTnT function onTouch(part) if part.Name == ("Bun1") then local hb = Instance.new("Model", game.Workspace) hb.Name = ("Hamburger") script.Parent.Anchored = true part.Anchored = true script.Parent.Parent = game.Workspace.Hamburger part.Parent = game.Workspace.Hamburger end end script.Parent.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
gerov
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 5504 |
|
|
| 16 Mar 2015 12:07 PM |
Lemme write something out for you...
local m = Instance.new("Model", workspace) for i,v in pairs(location.of.parts:GetChildren()) do v.Parent = m end
local mainPart = m.Part --You can change that
for i,v in pairs(m:GetChildren()) do local w = Instance.new("Weld", v) w.Part0 = v w.Part1 = mainPart w.C1 = mainPart:toObjectSpace(v.CFrame) end
I think that'll make it all move as one and be group together.
Dolph Lundgren of OT. |
|
|
| Report Abuse |
|
|
gerov
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 5504 |
|
|
| 16 Mar 2015 12:10 PM |
Edit:
local m = Instance.new("Model", workspace) for i,v in pairs(location.of.parts:GetChildren()) do v.Parent = m v.Anchored = false end
local mainPart = m.Part --You can change that
for i,v in pairs(m:GetChildren()) do local w = Instance.new("Weld", v) w.Part0 = v w.Part1 = mainPart w.C1 = mainPart:toObjectSpace(v.CFrame) end
Dolph Lundgren of OT. |
|
|
| Report Abuse |
|
|