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: how would I do this?

Previous Thread :: Next Thread 
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
01 Aug 2014 06:59 PM
How would I make a brick move, say, 5 studs from another brick? The bricks are both rotating so it seems a little tricky.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
01 Aug 2014 07:02 PM
5 studs in which brick's direction?
The first one's right or?
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
01 Aug 2014 07:05 PM
5 studs away from it. Since they rotate the axis that it would move would change.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
01 Aug 2014 07:07 PM
Okay, but what direction?
Away from it doesn't mean anything, 5 studs in any direction is essentially moving it away from the other part.
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
01 Aug 2014 07:10 PM
Let's say 5 studs away from the back surface.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
01 Aug 2014 07:11 PM
part2.CFrame = part1.CFrame * CFrame.new(0, 0, 5 + (part1.Size.Z / 2));
Report Abuse
MysteryMilo is not online. MysteryMilo
Joined: 13 Aug 2010
Total Posts: 175
01 Aug 2014 07:13 PM
amount = 5 -- Studs to move.
axis = "y" -- x, y, or z
p1 = game.Workspace.Part1
p2 = game.Workspace.Part2

if axis == "x" then
p2.Position = Vector3.new(p1.Position.x+amount, p1.Position.y, p1,Position.z)
end

if axis == "y" then
p2.Position = Vector3.new(p1.Position.x, p1.Position.y+amount, p1,Position.z)
end

if axis == "z" then
p2.Position = Vector3.new(p1.Position.x, p1.Position.y, p1,Position.z+amount)
end
Report Abuse
Zerio920 is not online. Zerio920
Joined: 06 Apr 2012
Total Posts: 3311
01 Aug 2014 07:20 PM
@cntkillme: Thx, why is Size in there though since this is just the brick moving?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
01 Aug 2014 07:22 PM
Well you said 5 studs from the back surface, not the center of the brick so yeah.
If you meant 5 studs from the brick in general, just remove the addition
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