generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Picking random item for limited simulator error

Previous Thread :: Next Thread 
Querq is not online. 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 is not online. iE3H0
Joined: 18 Dec 2015
Total Posts: 48
19 Dec 2015 07:48 PM
Try adding prints or print what "limmited" is.
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
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 is not online. 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 is not online. 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 is not online. Querq
Joined: 10 Apr 2013
Total Posts: 486
19 Dec 2015 07:58 PM
Value is nil for some reason
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
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 is not online. Querq
Joined: 10 Apr 2013
Total Posts: 486
20 Dec 2015 04:19 PM
crashed game with the repeat lmao
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
21 Dec 2015 01:48 PM
add wait() after repeat
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image