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
 

Learning Lua

Previous Thread :: Next Thread 
cade2000 is not online. cade2000
Joined: 09 Aug 2009
Total Posts: 887
20 Apr 2014 11:10 AM
So I'm new to Lua and I'm trying to make a script which makes a block slowly move up the Y-cordinate.

part = script.Parent
while 0 < 1 do
part.Position[1] = part.Position[1] + 1 --Since Position is in a Tuple
--I'm trying to get [0,1,2] or [x,y,z] out of the tuple.
--After that I'm trying to modify it. What am I doing wrong.
end
Report Abuse
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
20 Apr 2014 11:12 AM
You need to use a wait in that loop or else your game would just crash since 1 is always more than 0. Also, use CFrame:
http://wiki.roblox.com/index.php?title=CFrame

~The herp lerped a derp~
Report Abuse
subenari is not online. subenari
Joined: 23 Mar 2011
Total Posts: 116
20 Apr 2014 11:12 AM
part = script.Parent
y = script.Parent.Position.Y
while wait() do
y = y+1
part.CFrame = CFrame.new(Vector3.new(part.Position.X, y, part.Position.Z)
end

i'm' sure there are other ways to do it that are better than this but this was all I could think of
Report Abuse
PompeyTheGreat is not online. PompeyTheGreat
Joined: 10 Apr 2011
Total Posts: 5615
20 Apr 2014 11:14 AM
Not sure what a Tuple is, but if you want to move it up only the Y-Axis you can do something with this:

p = part.Position
while wait(.1) do
p = p + Vector3.new(p.x, p.y + 1, p.z)
end
Report Abuse
cade2000 is not online. cade2000
Joined: 09 Aug 2009
Total Posts: 887
20 Apr 2014 11:20 AM
A tuple is like a list but organized differently.

thx guys.
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