Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. -- This doesn't actually have any Lua format, so we'll just be stuck with JavaScript, it's the closest thing to use. I guess. rip english
  2.  
  3. --Alright, so let's start with creating a part, and moving it to a certain position in Workspace.
  4.  
  5. local i = Instance.new("Part", workspace) -- Instance.new() is what you use to create new objects/instances. It takes two arguments, first the object type, like part, and then where you want to parent it to, in this case workspace. I guess I should cover the heirarchy. So, anything that contains an object, is a parent, and anything that's inside of another part is a child. It sounds complicated and weird, but you'll learn how it works in time.
  6.  
  7. So, we have our part, which is set by the variable 'i'
  8.  
  9. Variables are just keywords that store other things, known as DataTypes. There's a bunch of DataTypes, there's Vector3s, CFrames, Region3s, a bunch of stuff, but don't worry about any of that right now. (also numbers and 'strings').
  10.  
  11. So, if I say:
  12.  
  13. myVariable = 5
  14.  
  15. print(myVariable), it'll display '5' in the output.
  16.  
  17. A string is basically a word, or test. "If I put something in quotation marks like this, it becomes a string. You always use a string when you're trying to apply text."
  18.  
  19. With this said, if I say:
  20.  
  21. myString = "Hi."
  22.  
  23. print(myString)
  24.  
  25. I'm pretty sure you can guess what'll happen; the output will display 'Hi.'
  26.  
  27. Anyways, back to the part.
  28.  
  29. So, we want to put the part at a position of 5 on the X axis, 7 on the Y axis, and 9 on the Z axis. To do this, we'll get the position of the object (and i'm explaining this horribly, but it does work lmao) like so:
  30.  
  31. i.Position, since we have the object stored in the variable 'i'. Or, we could just do workspace.Part, assuming that it's the only part in workspace under the name of "Part".Array
  32.  
  33. So, we have i.Position, now we'll want to give it a new position, we do this by saying:
  34.  
  35. i.Position = Vector3.new() -- We'll need to supply Vector3.new() with the arguments. It takes in order of: x, y, z. So let's do that.
  36.  
  37. i.Position = Vector3.new(5, 7, 9)
  38.  
  39. So, we do this, and now the part has a position of 5, 7, 9.
  40.  
  41. Also, I reccomend that you watch all the videos in this playlist, as it'll help familiarize you with Studio and how you can use it. It'll really help the learning process. https://www.youtube.com/watch?v=QWg8LbV6dpM&list=PLuEQ5BB-Z1PLIGkISgNBZVPgC2aV40y-V
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement