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
 

Sound play script does not work. Help?

Previous Thread :: Next Thread 
Tonitoni is not online. Tonitoni
Joined: 14 Mar 2009
Total Posts: 6429
20 Apr 2014 11:42 AM
local sound = script.Parent.Suspense
local enabled = true -- Debounce
local touchbrick = script.Parent

-- Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=142285032")

function onTouched(hit)
print(hit)
if enabled == true then
sound:Play()
print("Sound playing")
enabled = false -- Debounce
wait(120)
touchbrick:Destroy()
end
end

script.Parent:connect(onTouched)

No output, not even from the prints...
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 11:44 AM
Connection line is wrong. script.Parent.Touched:connect(onTouched)
Report Abuse
Tonitoni is not online. Tonitoni
Joined: 14 Mar 2009
Total Posts: 6429
20 Apr 2014 11:50 AM
Ah, thanks! Also, is it so that you cannot use variables for the connection line? I tried writing touchbrick:connect(onTouched)but the script wouldn't work when I did that.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
20 Apr 2014 11:56 AM
You would have to do touchbrick.Touched. Because touched is the event you are connecting the function to
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