|
| 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
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 20 Apr 2015 12:22 PM |
You missed a bunch of ends
|
|
|
| Report Abuse |
|
|
|
| 20 Apr 2015 12:23 PM |
| i said ive never done this before |
|
|
| Report Abuse |
|
|
| |
|
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
|
  |
| 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 |
|
|
|
| 20 Apr 2015 12:26 PM |
| ive ended it 5 times but it still dosent work |
|
|
| Report Abuse |
|
|
|
| 20 Apr 2015 12:26 PM |
| http://wiki.roblox.com/index.php?title=Scope#Lexical_Scoping |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 20 Apr 2015 12:27 PM |
| he didnt tell me to use local |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 20 Apr 2015 12:29 PM |
'he'
OoOoOoOoOoOoOoOoOoh no
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
| |
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
| |
|
|
| 20 Apr 2015 12:31 PM |
I mean.. song = math.random(1, 5) print(song)
That works fine too. |
|
|
| Report Abuse |
|
|
| |
|
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 |
|
|