I have tried Instance.new ("Part") but it did nothing.
What does Instance.new do?
2 answers
it creates a new object in the game
if ur trying to make a new part try doing
local part = Instance.new("Part")
part.Parent = game.Workspace
part.Name = "NewPart"
--Now theres a new Part in the workspace
Instance.new creates a new object in the game. It is highly used by scripters, and can be used to make a variety of things.
Let's break down how Instance.new works.
Instance.new -This creates a new instance that can be changed around
() - These tell what the instance should be, and where it should be, it's important to use "" when telling what the object should be, you also need to use correct capitalization. If I were to make a spotlight, I would say Instance.new("SpotLight") not Instance.new("Spotlight") because Roblox refers to the first way as correct.
There are also multiple ways to use it. These are the only two I know of.
--Way 1--
Instance.new("Part", game.Workspace) --Important to use caps for the parts name, and the comma is also important. After the comma, you put a space, and put where you want the part to go, for instance, I wanted my part to go into game.Workspace, so that's where it will go.
--Way 2--
local part = Instance.new("Part") --Over here I didn't put the comma because I wasn't telling where the part should go. I called the part, a part in the script so that I can tell it to do more things.
part.BrickColor = BrickColor.new('Really Red') ---This changes the part color
part.Parent = game.Workspace --This tells where the part should go
local light = Instance.new("SpotLight") --This creates a light.
light.Parent = part --This changes the light's parent to the part we made earlier
Way 2 is how a lot of scripters use Instance.new()
Instance.new is probably one of the most important things scripters use. For more information about Instance.new you can always go to http://wiki.roblox.com/index.php?title=Instance_(table) For more information about anything script-related, you can always ask here, or go to http://wiki.roblox.com or go to the forums on Roblox!
This discussion is preserved as it was. New answers, comments, and votes are closed.
