|
| 27 Sep 2013 08:22 PM |
function onClicked() S = game.Workspace.Script.Sound
S:play()
It is supposed to play a sound. Sorry I am not a good scripter. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 08:24 PM |
| No, it won't work. Syntax error, you have an un "end"-ed function. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 08:26 PM |
function onClicked() S = game.Workspace.Script.Sound
S:play() end |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 08:26 PM |
| It is in a TextButton by the way. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 08:27 PM |
| Your script will now run, but nothing will happen. Are you going to call the function you made at some point? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 27 Sep 2013 08:31 PM |
What you named the function makes me thing you want to connect it to an event. This calls the function whenever the event happens.
In your case, you may want:
script.Parent.MouseButton1Down:connect(onClicked) |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 08:33 PM |
script.Parent.MouseButton1Down:connect(onClicked) S = game.Workspace.Script.Sound
S:play() end |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 08:37 PM |
| So close, and yet so far. You could probably guess this one out. |
|
|
| Report Abuse |
|
|
Usering
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 10281 |
|
|
| 27 Sep 2013 08:42 PM |
script.Parent.MouseButton1Down:connect(function() workspace.Script.Sound:Play() end) |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Sep 2013 08:46 PM |
script.Parent.MouseButton1Down:connect(function() StarterGui.ScreenGui.Frame.TextButton.Script.Sound:Play() end)
It isnt in workspace, it is in a startergui so would this work? |
|
|
| Report Abuse |
|
|
Usering
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 10281 |
|
|
| 27 Sep 2013 08:47 PM |
Is the sound a child of the script?
script.Parent.MouseButton1Down:connect(function() script.Sound:Play() end)
|
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 08:49 PM |
| Scenario: I wan't it so when you click on a button it plays a sound so I made a TextButton with the script inside it and the sound inside the script (like not in the actual script but in the object) |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Sep 2013 08:54 PM |
| Thatwasconfusingcanyoupleasere-wordit |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 08:56 PM |
It goes something like this:
StarterGui > ScreenGui > Frame > TextButton > Script > Sound
Inside the StarterGui section is a ScreenGui then inside that is the Frame then inside that is the TextButton and inside that is the Script and inside the script is the Sound. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 08:59 PM |
| The arrows were a much clearer. Try the script Usering posted. |
|
|
| Report Abuse |
|
|
|
| 27 Sep 2013 09:00 PM |
thanks for so much help (it worked) :D |
|
|
| Report Abuse |
|
|