Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I need help with instances?

So while watching a tutorial on instances, nothing would work, other than creating the Part.

Part = Instance.new("Part", game.Workspace)
Part.anchored = true
Part.BrickColor = BrickColor.new("Bright Red")
Part.Material = Wood
Part.Transparency = .5
Part.name = Mahogany 

I tried playing around with it but it still wouldn't work. Am I doing something wrong?

1 answer

✓ Accepted answer

This code will never get past line 2, because you tried to access a property that doesn't exist.

Now, you may be thinking "Wait, anchored doesn't exist? wotttt???" and you'd be totally right. anchored does not exist.

Anchored does.

Lua is case-sensitive, so you have to be very diligent with your capitalization. Since the Anchored property has a capital A, you must always use a capital A when accessing it.

Part.Anchored = true

You have the same problem on line 6. The Name property has a capital N.



A slightly different error is made on line 4 and 6. You can never edit a property with just plain text, unless they're variables or something. Both theses properties are edited using strings. A string is just a collection of characters, surrounded by quotation marks.

Part.Material = "Wood"
Part.Name = "Mahogany"

3 comments

0

So I officially feel like an idiot....Should've double checked the script beofe going on here.

0

Can you answer this question as well----> Can you add a BillboardGui using instance.new into a part that was made using an instance?

0

Of course you can.

This discussion is preserved as it was. New answers, comments, and votes are closed.