Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I need help figuring out the "Instance.new()" Roblox script command. Anyone help?

Asked by 3 years ago

Hey! I'm new to scripting, I know there is something called "Instance.new()" that inserts a part, but I can't find any good explanations. If anyone could give me a brief tutorial on "instance.new()" command It would be most helpful!

0
Instance.new creates a new instance, thats pretty much all Instance.new does ABCTrainerDude 12 — 3y
0
Instance is a entity, Instance.NEW creates a new instance ABCTrainerDude 12 — 3y
0
I know, but I want to know how it works fishboy141516 12 — 3y
0
What I mean is how do you parent the instance?, how do you specify a part? fishboy141516 12 — 3y
View all comments (4 more)
1
Example: local part = Instance.new("Part") part.Parent = workspace ABCTrainerDude 12 — 3y
0
You say part.Parent = YOUR SERVICE HERE ABCTrainerDude 12 — 3y
0
Hope I helped! ABCTrainerDude 12 — 3y
0
That helped, Thanks! fishboy141516 12 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

Instance.new() is a constructor function that returns a blank Instance of the given type. The Instance isn't "created" until you give said Instance a parent.

When the returned value is retrieved, it will contain the Instance specified under the constructor parameter, which is the ClassName of the Instance you want the function to return. (An Instance's ClassName tells you what kind of an Instance it is. For example, IntValues have the IntValue ClassName.)

If the value is not given a parent, the Instance will not be "created" and will sit in thin air. You can still edit its properties, but you can't access it from Explorer because it is, by strict definition, nil until you actually give it a parent.

Ad

Answer this question