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
 

Scripting moving objects(Need help)

Previous Thread :: Next Thread 
LuffyGear3 is not online. LuffyGear3
Joined: 05 Jul 2011
Total Posts: 16
12 Dec 2016 08:14 PM
I'm new to coding, I'm trying to code a brick to go back and fourth in between two platforms like a mini Obby. The only thing I can do is make it go in one direction with this simple few lines of code.

while true do
script.Parent.Position = script.Parent.Position + Vector3.new(0, 0, 1)
wait(0.1)

end
How would I make it go back and forth in a set location?
Report Abuse
alij12 is not online. alij12
Joined: 03 Oct 2011
Total Posts: 1204
12 Dec 2016 08:18 PM
If the brick is moving along the Z-Axis then just check if the Z position if greater than a certain limit

i.e:

local limit = 10


limit = limit + script.Parent.Position.Z
while wait() do
if script.Parent.Position.Z < limit then
script.Parent.Position = script.Parent.Position + Vector3.new(0,0,1)
else
script.Parent.Position = script.Parent.Position + Vector3.new(0,0,-1)
end
end


Report Abuse
newcoolman2 is not online. newcoolman2
Joined: 01 Apr 2010
Total Posts: 2637
12 Dec 2016 08:24 PM
########################################################################################################################################################################################################################################
Report Abuse
newcoolman2 is not online. newcoolman2
Joined: 01 Apr 2010
Total Posts: 2637
12 Dec 2016 08:27 PM
here.

goo.gl/2Xk2Kk


Report Abuse
LuffyGear3 is not online. LuffyGear3
Joined: 05 Jul 2011
Total Posts: 16
12 Dec 2016 08:28 PM
Thank you for your help!
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