Colonized
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 160 |
|
|
| 08 May 2013 05:33 PM |
Main - A gui frame with text labels: Armor, Attack, Size, Speed and a Button Vehicles - A configuration folder with values inside
for i,v in ipairs(Main.Armor:GetChildren()) do if v.Num.Value >= Vehicles[i].Armor.Value then v.BackgroundColor3 = Color3.new(255/255, 85/255, 0/255) end end
Why is it saying attempt to index field '?' (a nil value) |
|
|
| Report Abuse |
|
|
|
| 08 May 2013 05:36 PM |
| Did you label what each variable means? |
|
|
| Report Abuse |
|
|
Colonized
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 160 |
|
| |
|
Colonized
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 160 |
|
|
| 08 May 2013 05:40 PM |
| I think the problem is, the Vehicles[i] part runs through the top values for some reason, and there's only 3 of them while there are 10 gui parts to be changed. I only want to compare all 10 values of the guis to a SINGLE value in the Vehicles[i] part |
|
|
| Report Abuse |
|
|
scrat101
|
  |
| Joined: 26 Jan 2009 |
| Total Posts: 331 |
|
|
| 08 May 2013 05:45 PM |
| Do you mean that you only want to compare those gui values to a single value at a time? |
|
|
| Report Abuse |
|
|
Colonized
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 160 |
|
|
| 08 May 2013 05:47 PM |
| Yes, it's a stat bar, and it's set by a value in the config folder (So if the value is 5, then 5 of 10 squares will light up) but its coming up as nil.. it's to do with the Vehicles[i] part |
|
|
| Report Abuse |
|
|
scrat101
|
  |
| Joined: 26 Jan 2009 |
| Total Posts: 331 |
|
|
| 08 May 2013 05:56 PM |
| I am getting that you want your index variable for your Vehicle table to remain static. If that is the case, your problem may be that you are using your i counter to index your Vehicle table. The i variable keeps getting bigger and bigger until it overflows the table. |
|
|
| Report Abuse |
|
|
Colonized
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 160 |
|
|
| 08 May 2013 05:59 PM |
| How would I fix this? The values for the vehicles make a gui button, which when pressed is what triggers this function to happen |
|
|
| Report Abuse |
|
|
scrat101
|
  |
| Joined: 26 Jan 2009 |
| Total Posts: 331 |
|
|
| 08 May 2013 06:03 PM |
| Do you have this inner loop you just showed us being inside a larger loop? |
|
|
| Report Abuse |
|
|
|
| 08 May 2013 06:05 PM |
| Can we have the entire script please? Variables and all. We can't help you without everything. |
|
|
| Report Abuse |
|
|
Colonized
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 160 |
|
|
| 08 May 2013 06:07 PM |
Sure, here's the Hierarchy: puu.sh/2PzT5/19143cd142.png
I'll PM the script
|
|
|
| Report Abuse |
|
|