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: Print Random Number

Previous Thread :: Next Thread 
littelbigblox is not online. littelbigblox
Joined: 29 Aug 2011
Total Posts: 1956
20 Apr 2015 12:21 PM
never used or done this before and i was wondering on how to get it to work because ive tried looking for how to do it and i cant find it

song = math.random(1, 5)

if song == 1 then
print '1'

if song == 2 then
print '2'

if song == 3 then
print '3'

if song == 4 then
print '4'

if song == 5 then
print '5'
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
20 Apr 2015 12:22 PM
You missed a bunch of ends
Report Abuse
littelbigblox is not online. littelbigblox
Joined: 29 Aug 2011
Total Posts: 1956
20 Apr 2015 12:23 PM
i said ive never done this before
Report Abuse
littelbigblox is not online. littelbigblox
Joined: 29 Aug 2011
Total Posts: 1956
20 Apr 2015 12:25 PM
Dosent work
Report Abuse
Atoshi is not online. Atoshi
Joined: 20 Nov 2008
Total Posts: 92
20 Apr 2015 12:25 PM
You need to end it. No one's talking about if you've done it before or not.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
20 Apr 2015 12:25 PM
Doesn't excuse your absence of ends on the ifs
Also use elseif
Report Abuse
littelbigblox is not online. littelbigblox
Joined: 29 Aug 2011
Total Posts: 1956
20 Apr 2015 12:26 PM
ive ended it 5 times but it still dosent work
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
20 Apr 2015 12:26 PM
http://wiki.roblox.com/index.php?title=Scope#Lexical_Scoping
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
20 Apr 2015 12:26 PM
elunate just told you how to fix it

local ranNum = math.random(1,5)

if ranNum == 1 then
print("1")
elseif ranNum == 2 then
print("2")
elseif ranNum == 3 then
print("3")
end

and so on
Report Abuse
littelbigblox is not online. littelbigblox
Joined: 29 Aug 2011
Total Posts: 1956
20 Apr 2015 12:27 PM
he didnt tell me to use local
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
20 Apr 2015 12:29 PM
'he'

OoOoOoOoOoOoOoOoOoh no


I script -~ chimmihc
Report Abuse
littelbigblox is not online. littelbigblox
Joined: 29 Aug 2011
Total Posts: 1956
20 Apr 2015 12:29 PM
she then!
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
20 Apr 2015 12:31 PM
pfft "she"
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
20 Apr 2015 12:31 PM
I mean..
song = math.random(1, 5)
print(song)

That works fine too.
Report Abuse
littelbigblox is not online. littelbigblox
Joined: 29 Aug 2011
Total Posts: 1956
20 Apr 2015 12:32 PM
thx epic
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
20 Apr 2015 12:32 PM
Pffft everyone on the Internet is a boy until they're a girl. The problem wasn't local, it's that you can't if
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