xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 05 Nov 2011 08:03 PM |
The script is suppose to give a series of hats to the corresponding player. For example players[1] will get all the hats in HatID[1]
Output: Players.xvgigakid.Backpack.Script:24: attempt to get length of field '?' (a nil value)
HatID = { player1 = {65075702,65075763,65075809}, player2 = {123,456,789}, } players = {"xvgigakid", "bob"} wait(0.1337) num = 0 player = script.Parent.Parent print("a") for i = 1, #players do print("a") if player.Name == players[i] then print("a") num = i end end if num ~= 0 then for x = 1, #HatID[num] do --LINE24--LINE24--LINE24--LINE24--LINE24--LINE24 stuff = player.Character:GetChildren() for z = 1, #stuff do if stuff[i]:IsA("Hat") then stuff[i]:remove() end end hat = game:service("InsertService"):LoadAsset(HatID[x]) end end
|
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 08:10 PM |
num = i
to
num = players[i]
try that |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 08:13 PM |
| @Cachi I'm sure that will make the number an object value. |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 08:32 PM |
| Your HatID table does not have numerical indices, which is what the # operator gets, so technically it's reading the length of your table as 0. |
|
|
| Report Abuse |
|
|
xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 05 Nov 2011 08:36 PM |
@King
I see :/ I never was good at tables. Im guessing the soloution to this has something to do with MetaTables.
So king how do I fix it? |
|
|
| Report Abuse |
|
|
|
| 05 Nov 2011 08:39 PM |
HatID = { {65075702,65075763,65075809}, {123,456,789}, }
|
|
|
| Report Abuse |
|
|
xvgigakid
|
  |
| Joined: 22 Jun 2008 |
| Total Posts: 4407 |
|
|
| 05 Nov 2011 08:40 PM |
Really? Is that all? Lol that wasn't so hard :/ |
|
|
| Report Abuse |
|
|