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 » Scripting Helpers
Home Search
 

Re: 'Random" (a nil value)?

Previous Thread :: Next Thread 
Jakeup10 is not online. Jakeup10
Joined: 29 Nov 2008
Total Posts: 6782
19 Jun 2013 03:37 PM
Workspace.Script:8:attempt to call field 'Random" (a nil value)
That is the only output.

EggValues = {
Egg1 = 1,
Egg2 = 2,
Egg3 = 3
}


Random = math.Random(10)


while true do
for i,v in pairs(EggValues) do
if Random == EggValues then
print(Random)
wait(1)
end
end
end

I am assuming that the whole "Name = *Script or area*" doesn't work with math.random, or is it something else?
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
19 Jun 2013 03:39 PM
local Random

not Random
Report Abuse
Lukekneenew is not online. Lukekneenew
Joined: 20 Oct 2009
Total Posts: 746
19 Jun 2013 03:39 PM
EggValues = {
Egg1 = 1,
Egg2 = 2,
Egg3 = 3
}


Random = math.Random(10)


while true do
for i,v in pairs(EggValues) do
if Random == v then
print(Random)
wait(1)
end
end
end

Dat work?
Report Abuse
Jakeup10 is not online. Jakeup10
Joined: 29 Nov 2008
Total Posts: 6782
19 Jun 2013 03:42 PM
Nope, same error with both...
Report Abuse
ALERIFICALNEUMORAITI is not online. ALERIFICALNEUMORAITI
Joined: 21 Nov 2010
Total Posts: 302
19 Jun 2013 03:45 PM
random
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
19 Jun 2013 03:47 PM
1) You need a wait, or that'll crash.
2) Do what ALER posted. As said, while very non-descriptive, it's math.random() not math.Random()
Report Abuse
Lukekneenew is not online. Lukekneenew
Joined: 20 Oct 2009
Total Posts: 746
19 Jun 2013 03:48 PM
EggValues = {
1,
2,
3
}


Random = math.random(10)


while true do
for i,v in pairs(EggValues) do
if Random == v then
print(Random)
wait(1)
end
end
end

Works now?
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
19 Jun 2013 03:56 PM
idiot who posted first saying local random not random


GTFO

no that won't work

math.random(numhere,numhere)
needs 2 arguments
Report Abuse
Jakeup10 is not online. Jakeup10
Joined: 29 Nov 2008
Total Posts: 6782
19 Jun 2013 05:12 PM
@Luke,

No, that wouldn't work because I will need the names later, plus it only keeps printing 3, and only 3.

@Master,

Still doesn't work, but the dual numbers doesn't change anything, saying just putting in 1 number will make it from 1 to that number...

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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