Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 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
- --Alright, so let's start with creating a part, and moving it to a certain position in Workspace.
- 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.
- So, we have our part, which is set by the variable 'i'
- 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').
- So, if I say:
- myVariable = 5
- print(myVariable), it'll display '5' in the output.
- 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."
- With this said, if I say:
- myString = "Hi."
- print(myString)
- I'm pretty sure you can guess what'll happen; the output will display 'Hi.'
- Anyways, back to the part.
- 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:
- 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
- So, we have i.Position, now we'll want to give it a new position, we do this by saying:
- 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.
- i.Position = Vector3.new(5, 7, 9)
- So, we do this, and now the part has a position of 5, 7, 9.
- 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