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 » Scripting Helpers
Home Search
 

Re: Will this work?

Previous Thread :: Next Thread 
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
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
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
27 Sep 2013 08:24 PM
No, it won't work. Syntax error, you have an un "end"-ed function.
Report Abuse
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
27 Sep 2013 08:26 PM
function onClicked()
S = game.Workspace.Script.Sound

S:play()
end
Report Abuse
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
27 Sep 2013 08:26 PM
It is in a TextButton by the way.
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
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
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
27 Sep 2013 08:28 PM
How?
Report Abuse
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
27 Sep 2013 08:31 PM
Please tell me
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
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
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
27 Sep 2013 08:33 PM
script.Parent.MouseButton1Down:connect(onClicked)
S = game.Workspace.Script.Sound

S:play()
end
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
27 Sep 2013 08:37 PM
So close, and yet so far. You could probably guess this one out.
Report Abuse
Usering is not online. 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
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
27 Sep 2013 08:42 PM
A hint please?
Report Abuse
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
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 is not online. 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
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
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
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
27 Sep 2013 08:53 PM
Come back please?
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
27 Sep 2013 08:54 PM
Thatwasconfusingcanyoupleasere-wordit
Report Abuse
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
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
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
27 Sep 2013 08:59 PM
The arrows were a much clearer. Try the script Usering posted.
Report Abuse
EmeraldRooster is not online. EmeraldRooster
Joined: 18 Aug 2013
Total Posts: 2553
27 Sep 2013 09:00 PM
thanks for so much help
(it worked) :D
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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