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

I need help with instances?

Asked by 8 years ago

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

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
8 years ago

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"
0
So I officially feel like an idiot....Should've double checked the script beofe going on here. secretboy6 68 — 8y
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? secretboy6 68 — 8y
0
Of course you can. Perci1 4988 — 8y
Ad

Answer this question