generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Group Parts

Previous Thread :: Next Thread 
Bubu2319 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image