|
| 04 Dec 2014 03:42 PM |
I have the ScreenGUI and the music plays, All the audio is named JSong1, JSong2, JSong3, JSong4, JSong5.
The problem I have is that the audio will not stop playing when you press the off button, and here is the script so do I need to fix anything?
local Button = script.Parent
function onClicked()
JSong1:Stop()
function onClicked()
JSong2:Stop()
function onClicked()
JSong3:Stop()
function onClicked()
JSong4:Stop()
function onClicked()
JSong5:Stop()
end
Button.MouseButton1Click:connect(onClicked)
If I can get feedback quickly that would be greatly appreciated. |
|
|
| Report Abuse |
|
| |
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 04 Dec 2014 03:52 PM |
I suggest you read up on functions and events. First off you are missing 4 ends. The output would have flagged this. Second you are writing to the same function variable 5 times. That's like doing this x = 1 x = 2 x = 3 x = 4 x = 5 and expecting print(x) to print 1 2 3 4 5 Incase it's not clear it will only print 5.
--corrected code.
local Button = script.Parent
function onClicked()
JSong1:Stop() JSong2:Stop() JSong3:Stop() JSong4:Stop() JSong5:Stop()
end
Button.MouseButton1Click:connect(onClicked) |
|
|
| Report Abuse |
|