Querq
|
  |
| Joined: 10 Apr 2013 |
| Total Posts: 486 |
|
|
| 19 Dec 2015 07:41 PM |
Heres my code:
local limiteds = { test1 = { value = 999999999, itemid = -1, released = false } }
function tablelength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end
function randomitem() repeat local limited = limiteds[math.random(tablelength(limiteds))] until limited.released == false end
I'm getting a "17:28:17.918 - Workspace.Main:18: attempt to index local 'limited' (a nil value)" error and I don't understand how to fix it. Any help? |
|
|
| Report Abuse |
|
|
iE3H0
|
  |
| Joined: 18 Dec 2015 |
| Total Posts: 48 |
|
|
| 19 Dec 2015 07:48 PM |
| Try adding prints or print what "limmited" is. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 07:53 PM |
*limiteds
Thats your error. You spelled it wrong.
Did you know the chance of you being born was 1 in 400 trillion? |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 19 Dec 2015 07:54 PM |
@Lil
"local limited = limiteds[math.random(tablelength(limiteds))]" |
|
|
| Report Abuse |
|
|
iE3H0
|
  |
| Joined: 18 Dec 2015 |
| Total Posts: 48 |
|
|
| 19 Dec 2015 07:55 PM |
I think Lil thought he spelled limiteds wrong because of me xD
I made a typo |
|
|
| Report Abuse |
|
|
Querq
|
  |
| Joined: 10 Apr 2013 |
| Total Posts: 486 |
|
|
| 19 Dec 2015 07:58 PM |
| Value is nil for some reason |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2015 08:01 PM |
function randomitem() local limited repeat local limited = limiteds[math.random(tablelength(limiteds))] until limited and limited.released == false end
#code Instance.new("BodyThrust",SenseiWarrior).position = CFrame.new(SenseiWarrior,YourGirlsDMs) |
|
|
| Report Abuse |
|
|
Querq
|
  |
| Joined: 10 Apr 2013 |
| Total Posts: 486 |
|
|
| 20 Dec 2015 04:19 PM |
| crashed game with the repeat lmao |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
| |
|