Answered by
8 years ago Edited 8 years ago
Let start with the errors.
Line 1:
instance.new
. Instance should be capitalized.
Line2:
coolbrick.name = 'Meteor')
. Name should be capitalized, and the parenthesis is unnecessary.
2 | coolbrick.Name = 'Meteor`. |
Line 3:
coolbrick.Anchored = False
. Boolean values, (true and false values ), should be lowercase.
2 | coolbrick.Anchored = false . |
Line 4:
game.Workspace.coolbrick.
. Since the object itself is not named coolbrick, but the variable of it is, you cannot do this. However, you can use game.Workspace.Meteor
since you named the object meteor, or you can do coolbrick.Touched
since you defined coolbrick as a variable.
Line 4: continued
:connect(functon(poop)
. Function is misspelled.
Line 5:
poop:Destroy()
. I would run an if-statement before you delete anything, so that you aren't deleting the baseplate or anything. Also, you should put this a few lines down, so that you can still get the position for the explosion
A few notes:
Lua is a case-sensitive language, meaning you have to be careful when it comes to capitals and lowercasing.
For instance, you had instance
, when Lua only reads Instance
. This would cause an error. Samething with False
.
If you have a variable already defined, you don't need to find the part you defined in workspace. Simply use the variable.
Scripting Time:
01 | local coolbrick = Instance.new( 'Part' , game.Workspace) |
02 | coolbrick.Name = 'Meteor' |
03 | coolbrick.Anchored = false |
06 | coolbrick.Touched:connect( function (poop) |
07 | if poop.Name ~ = 'Baseplate' and poop ~ = nil then |
08 | local boom = Instance.new( 'Explosion' , game.Workspace) |
09 | boom.Position = poop.Position |
If this helped you, don't forget to accept my answer.