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 » Scripting Helpers
Home Search
 

Re: I plan on moving a bunch of parts away from a center point.

Previous Thread :: Next Thread 
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
23 Apr 2014 04:14 PM
The center point with be the geometric center of the parts, than it would CFrame them like 2 studs away from the center, like an explosion, but, not explody.
Also I'm not to good with "return" it confuses me.





for _,part in pairs(script.Parent:GetChildren())do
if part:IsA"Part" then
What
end
end
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
23 Apr 2014 04:16 PM
In what direction(s)?
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
23 Apr 2014 04:17 PM
The direction would be away from the center, Hard to explain so I used the explosion thing.
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
23 Apr 2014 04:19 PM
Gotcha:

centre = Vector3
dist = 2

for __,part in pairs(script.Parent:GetChildren())do
if part:IsA"Part" then
local dir = (centre - part.Position).Unit
part.CFrame = part.CFrame + dir*dist
end
end
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
23 Apr 2014 04:21 PM
Your multiplying a number with a userdata...

And you don't multiply Vector3 values either...
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
23 Apr 2014 04:22 PM
Nuuuu...

*adds an e at the end of my first word of the last post*
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
23 Apr 2014 04:23 PM
I need help with getting the center..
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
23 Apr 2014 04:24 PM
Is it a model, Master?
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
23 Apr 2014 04:28 PM
Yes it is.
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
23 Apr 2014 04:30 PM
Here you go thenL


centre = script.Parent:GetModelCFrame.p
dist = 2

for _,part in pairs(script.Parent:GetChildren())do
if part:IsA"Part" then
local dir = (centre - part.Position).Unit
part.CFrame = part.CFrame + dir*dist
end
end

@beebee, trust me. I have plenty of experience
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
23 Apr 2014 04:43 PM
Thank you!
Also, I was trying to make it move away from the center, depending how far from the center it is, but I've having troubles.

I have this perfect cube that's 6x6x6, and made with 1x1x1 bricks and hollow on the inside, whats happening is not all the bricks are moving away from it as the same as their reflected brick.

for __,part in pairs(script.Parent:GetChildren())do
if part:IsA"Part" then
part.CFrame = part.CFrame+(script.Parent:GetModelCFrame().p - part.Position).Unit*-(script.Parent:GetModelCFrame().p - part.Position).magnitude
end
end
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
23 Apr 2014 04:44 PM
If you cut the brick in half, the bricks are the same distance away from the center, after the function happens, they are not.
Report Abuse
TheProgrammingMaster is not online. TheProgrammingMaster
Joined: 20 Aug 2011
Total Posts: 7602
23 Apr 2014 04:44 PM
NEVER MIND. I KNOW WHATS UP.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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