|
| 04 Jan 2012 08:30 PM |
script.Parent.ClickDetector.MouseClick:connect(function(Playah) if Playah.Name == script.Parent.Parent.Parent.OwnerName.Value and script.Parent.Parent.Parent.Cubes.Cube1:findFirstChild("Mesh") == nil and script.Parent.Parent.Parent.Cubes.Cube400:findFirstChild("Mesh") == nil then wait(3) for i = 0, 400 do m = Instance.new("BlockMesh") m.Name = "Mesh" m.Parent = script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i) wait(0.1) end elseif script.Parent.Parent.Parent.Cubes.Cube1.Mesh ~= nil and script.Parent.Parent.Parent.Cubes.Cube400.Mesh ~= nil then wait(3) for i = 0, 400 do script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i).Mesh:Remove() wait(0.1) end end end)
errors:
Workspace.Art Studio.Factory.Buttons.Finish Button.Finish:16: attempt to index a nil value Script "Workspace.Art Studio.Factory.Buttons.Finish Button.Finish", Line 16 stack end |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2012 08:35 PM |
("Cube"..i)
Something be wrong here... |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2012 08:37 PM |
| The part where it adds the mesh to all 400 blocks works, but not the part where it removes them. |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2012 08:45 PM |
You don't have a Cube0?
You have Cube1:FindFirstChild() and Cube400:FindFirstChild()
But your loop is from 0 to 400 |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2012 06:21 AM |
So this is what i would need?
script.Parent.ClickDetector.MouseClick:connect(function(Playah) if Playah.Name == script.Parent.Parent.Parent.OwnerName.Value and script.Parent.Parent.Parent.Cubes.Cube1:findFirstChild("Mesh") == nil and script.Parent.Parent.Parent.Cubes.Cube400:findFirstChild("Mesh") == nil then wait(3) for i = 1, 400 do m = Instance.new("BlockMesh") m.Name = "Mesh" m.Parent = script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i) wait(0.1) end elseif script.Parent.Parent.Parent.Cubes.Cube1.Mesh ~= nil and script.Parent.Parent.Parent.Cubes.Cube400.Mesh ~= nil then wait(3) for i = 1, 400 do script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i).Mesh:Remove() wait(0.1) end end end)
|
|
|
| Report Abuse |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 05 Jan 2012 09:01 AM |
script.Parent.ClickDetector.MouseClick:connect(function(Playah) if Playah.Name == script.Parent.Parent.Parent.OwnerName.Value and script.Parent.Parent.Parent.Cubes.Cube1:findFirstChild("Mesh") == nil and script.Parent.Parent.Parent.Cubes.Cube400:findFirstChild("Mesh") == nil then wait(3) for i = 1, 400 do m = Instance.new("BlockMesh") m.Name = "Mesh" m.Parent = script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i) wait(0.1) elseif script.Parent.Parent.Parent.Cubes.Cube1.Mesh ~= nil and script.Parent.Parent.Parent.Cubes.Cube400.Mesh ~= nil then wait(3) for i = 1, 400 do script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i).Mesh:Remove() wait(0.1) end end end end) |
|
|
| Report Abuse |
|
|
Blues714
|
  |
| Joined: 23 Dec 2008 |
| Total Posts: 6507 |
|
|
| 05 Jan 2012 09:48 AM |
script.Parent.ClickDetector.MouseClick:connect(function(Playah) if Player.Name == script.Parent.Parent.Parent.OwnerName.Value and script.Parent.Parent.Parent.Cubes.Cube0:findFirstChild("Mesh") == nil and script.Parent.Parent.Parent.Cubes.Cube400:findFirstChild("Mesh") == nil then wait(3) for i = 1, 400 do m = Instance.new("BlockMesh") m.Name = "Mesh" m.Parent = script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i) wait(0.1) else if script.Parent.Parent.Parent.Cubes.Cube0.Mesh ~= nil and script.Parent.Parent.Parent.Cubes.Cube400.Mesh ~= nil then wait(3) for i = 1, 400 do script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i).Mesh:Remove() wait(0.1) end end end end)
0 counts as a number! 0 to 400. 1 to 400 won't make it work. And, you didn't space else and if. It looked like this
(elseif) script.Parent.Parent.Parent.Cubes.Cube1.Mesh ~= nil and
Double check what you do. |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2012 04:12 PM |
wait so elseif needs to be else if?
I always thought you were supposed to make it one word in Lua... |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2012 04:21 PM |
ok, it still wont work...
Heres the script im using now...
script.Parent.ClickDetector.MouseClick:connect(function(Player) if Player.Name == script.Parent.Parent.Parent.OwnerName.Value and script.Parent.Parent.Parent.Cubes.Cube1:findFirstChild("Mesh") == nil and script.Parent.Parent.Parent.Cubes.Cube400:findFirstChild("Mesh") == nil then wait(3) for i = 0, 400 do m = Instance.new("BlockMesh") m.Name = "Mesh" m.Parent = script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i) wait(0.1) end else if script.Parent.Parent.Parent.Cubes.Cube1.Mesh ~= nil and script.Parent.Parent.Parent.Cubes.Cube400.Mesh ~= nil then wait(3) for i = 0, 400 do script.Parent.Parent.Parent.Cubes:findFirstChild("Cube"..i).Mesh:Remove() wait(0.1) end end end end)
And heres the errors...
Workspace.Art Studio.Factory.Buttons.Finish Button.Finish:16: attempt to index a nil value Script "Workspace.Art Studio.Factory.Buttons.Finish Button.Finish", Line 16 stack end
Notes: I have cubes 1-400 in a modle called Cubes, each wioth the names Cube1- Cube400. |
|
|
| Report Abuse |
|
|
Tkdriverx
|
  |
| Joined: 27 May 2008 |
| Total Posts: 235 |
|
|
| 05 Jan 2012 04:49 PM |
There doesn't have to be a space between the else and the if, 'else if' just makes it do an else (which inverts the previous 'if' statement) then it does another 'if' statement if the 'else' is true.
And also, if you have Cube1 - Cube400, it needs to be
for i = 1, 400 do
not
for i = 0, 400 do
because it should start at 1, not 0.
You should also just do a :GetChildren() function, it will make it easier to check if there's a mesh in the brick and then add one.
~ Tkdriverx ~ |
|
|
| Report Abuse |
|
|
Tkdriverx
|
  |
| Joined: 27 May 2008 |
| Total Posts: 235 |
|
|
| 05 Jan 2012 04:55 PM |
Also, to check if an item is inside another item, do :findFirstChild("Mesh"). This was on line 10:
else if script.Parent.Parent.Parent.Cubes.Cube1.Mesh ~= nil and script.Parent.Parent.Parent.Cubes.Cube400.Mesh ~= nil then
which should be changed to:
elseif script.Parent.Parent.Parent.Cubes:findFirstChild("Cube1"):findFirstChild("Mesh") ~= nil and script.Parent.Parent.Parent.Cubes:findFirstChild("Cube400"):findFirstChild("Mesh") ~= nil then
And it appears you put the and lines on separate lines, and they should be on the same line.
~ Tkdriverx ~ |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2012 05:02 PM |
Didn't anyone notice the bottom?
Workspace.Art Studio.... is supposed to be
Workspace["Art Studio"].whatever.whatever |
|
|
| Report Abuse |
|
|
Tkdriverx
|
  |
| Joined: 27 May 2008 |
| Total Posts: 235 |
|
|
| 05 Jan 2012 05:07 PM |
@epicfail22 That's how the Output prints errors.
~ Tkdriverx ~ |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2012 05:07 PM |
| it works now, thanks soo much |
|
|
| Report Abuse |
|
|
wuppii
|
  |
| Joined: 20 Feb 2010 |
| Total Posts: 1625 |
|
|
| 05 Jan 2012 05:11 PM |
| elseif and else if are both totally different. |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2012 07:39 PM |
@Tkdriverx
Oh woops didn't even realize it was output. I thought it was a connection line. |
|
|
| Report Abuse |
|
|