Practice New Instances

This tutorial let's you practice with NewInstances

by blepod

Author Avatar

For this practice, we're working with New Instances

So, what is a new instance? Well a new instance is.....well....a new instance

For example:

Instead of making a part, we can spawn one with a

script!

This is useful for if we want parts to appear at certain times to make

something happen. (That being whatever you choose)

So let's go with the idea of spawning a part with a new instance.

We would use the script:

part = Instance.new("Part", game.Workspace)

But...this just spawns a brick at the center of the world

(Where the player automatically spawns if there are no spawns)

And...it isn't even anchored

And I wanted this part to be blue...

Fortunately, we can fix these problems by doing simple steps.

So, yeah, let's say you wanted to make this part anchored, what would you do?

Well, once you go to the next line of script (line 2), type this in:

part.Anchored = true

This gives the part we created, the property of being anchored.

But what if you wanted to change the position?

Well, in the next line we would type:

part.Position = Vector3.new(NUMBER,NUMBER,NUMBER)

Are you starting to see a pattern?

For every line we would type a part.(whatever value is akin with it) and say what that value means.

This is because we are defining what we are working with (the part)

and giving its attributes.

Rather than list common variables for these, I must tell you this:

If you can understand the pattern and structure, then that is more important

than a specific attribute that you need.

Because, if you can understand the pattern and structure first, you can

actually do more with the concept quicker, and overall it'll be easier

to understand.

View in-game to comment, award, and more!