rpg877
|
  |
| Joined: 14 Sep 2008 |
| Total Posts: 447 |
|
|
| 10 Sep 2011 03:51 PM |
so im asking again:
what is wrong with my script?
local c = game.Lighting.Stores.Stores:GetChildren() for i = 1, #c do local f = game.Teams:GetChildren() for i = 1, #f do if f[i].TeamColor == script.Parent.Parent.Parent.Parent.Parent.TeamColor and c[i].Name == f[i].Name then local k = game.Workspace:GetChildren() for i = 1, #k do if k[i].Name == c[i].Name then c[i].LemonadeStand.Parent = k[i] end end end end end
this is just part of it here is the output:
Players.Player.PlayerGui.ScreenGui.Frame.LemonadeStand.Scri:18: attempt to index field '?' (a nil value) Script "Players.Player.PlayerGui.ScreenGui.Frame.LemonadeStand.Scri", Line 18 stack end Disconnected event because of exception |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2011 03:52 PM |
What's like 18...? :/
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
rpg877
|
  |
| Joined: 14 Sep 2008 |
| Total Posts: 447 |
|
|
| 10 Sep 2011 03:53 PM |
| oops i was going to post that sorry line 18 is this one "c[i].Name == f[i].Name then" |
|
|
| Report Abuse |
|
|
Dyvoliox
|
  |
| Joined: 08 Sep 2011 |
| Total Posts: 28 |
|
|
| 10 Sep 2011 03:55 PM |
| if c[i].Name == f[i].Name then |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2011 03:56 PM |
Okay, well, the problem is that you are overwriting i.
local c = game.Lighting.Stores.Stores:GetChildren() for i = 1, #c do local f = game.Teams:GetChildren() for x = 1, #f do if f[x].TeamColor == script.Parent.Parent.Parent.Parent.Parent.TeamColor and c[i].Name == f[x].Name then local k = game.Workspace:GetChildren() for z = 1, #k do if k[z].Name == c[i].Name then c[i].LemonadeStand.Parent = k[z] end end end end end
Then, on line 18. change f[i] to f[x]
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
rpg877
|
  |
| Joined: 14 Sep 2008 |
| Total Posts: 447 |
|
| |
|
|
| 10 Sep 2011 04:00 PM |
No problem.
-Like an __AWESOME__ boss |
|
|
| Report Abuse |
|
|
rpg877
|
  |
| Joined: 14 Sep 2008 |
| Total Posts: 447 |
|
|
| 10 Sep 2011 04:02 PM |
| ok now it doesn't say anything in the output but it wont bring the lemonade stand into the Workspace form the lighting like it is supposed to towards the end of the script. |
|
|
| Report Abuse |
|
|
rpg877
|
  |
| Joined: 14 Sep 2008 |
| Total Posts: 447 |
|
|
| 10 Sep 2011 04:13 PM |
knowone knows the answere? should i post the whole script?
function onButtonClicked()
script.Parent.Parent.Parent.Money.TextBox.Value.Value = script.Parent.Parent.Parent.Money.TextBox.Value.Value - 10
local c = game.Lighting.Stores.Stores:GetChildren() for i = 1, #c do local f = game.Teams:GetChildren() for x = 1, #f do if f[x].TeamColor == script.Parent.Parent.Parent.Parent.Parent.TeamColor and c[i].Name == f[x].Name then local k = game.Workspace:GetChildren() for z = 1, #k do if k[z].Name == c[i].Name then c[i].LemonadeStand.Parent = k[z]
end end end end end
script.Parent.Active = false
end
script.Parent.MouseButton1Click:connect(onButtonClicked)
|
|
|
| Report Abuse |
|
|
rpg877
|
  |
| Joined: 14 Sep 2008 |
| Total Posts: 447 |
|
| |
|
| |
|
rpg877
|
  |
| Joined: 14 Sep 2008 |
| Total Posts: 447 |
|
|
| 10 Sep 2011 04:26 PM |
| ya electric fixed that for me so that fixed one of the problems but there is still another that the output cant detect |
|
|
| Report Abuse |
|
|
| |
|
rpg877
|
  |
| Joined: 14 Sep 2008 |
| Total Posts: 447 |
|
| |
|
rpg877
|
  |
| Joined: 14 Sep 2008 |
| Total Posts: 447 |
|
|
| 10 Sep 2011 05:18 PM |
ok i changed the script to this:
local LemonadeStand = game.Workspace.Red1.LemonadeStand:Clone() game.Workspace.Red1.LemonadeStand:Remove()
function onButtonClicked()
local c = game.Workspace.Red1:GetChildren() for i = 1, #c do c[i]:Remove()
local lemon = LemonadeStand:Clone() lemon.Parent = game.Workspace.Red1 end
end
script.Parent.MouseButton1Click:connect(onButtonClicked)
it removes the lemonade stand on line 2 when i run the script but when i click the gui it doesnt do anything. |
|
|
| Report Abuse |
|
|