Faxu
|
  |
| Joined: 08 Feb 2010 |
| Total Posts: 2937 |
|
|
| 08 Jun 2014 02:08 AM |
Why does this script cause both sounds to play? The only reason I can think of for this is if I did the math.random wrong, but I can't figure out what it is.
_G.song = 1
while true do wait(5) if _G.song == 1 then sndid = (math.random(1,2)) if sndid == 1 then script.Parent.one:Play() elseif sndid == 2 then script.Parent.two:Play() else print("math.random did not create a valid sound ID") wait(120) end end end |
|
|
| Report Abuse |
|
|
|
| 08 Jun 2014 02:17 AM |
| It never does the wait(120) |
|
|
| Report Abuse |
|
|
Faxu
|
  |
| Joined: 08 Feb 2010 |
| Total Posts: 2937 |
|
|
| 08 Jun 2014 02:19 AM |
| Oh, I just realized this, although I'm not sure how I can fix this. Help? |
|
|
| Report Abuse |
|
|
Faxu
|
  |
| Joined: 08 Feb 2010 |
| Total Posts: 2937 |
|
|
| 08 Jun 2014 02:20 AM |
| Never mind, I can just put a wait after every else. |
|
|
| Report Abuse |
|
|
| |
|
Faxu
|
  |
| Joined: 08 Feb 2010 |
| Total Posts: 2937 |
|
|
| 08 Jun 2014 02:23 AM |
| Alright, I added a bunch of waits where appropriate and it's working quite perfectly now! Thanks! |
|
|
| Report Abuse |
|
|