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 » Scripters
Home Search
 

Re: How do I stop a sound playing in-game after 5 seconds?

Previous Thread :: Next Thread 
dope_broskii is not online. dope_broskii
Joined: 20 Mar 2011
Total Posts: 160
17 Apr 2017 05:23 PM
Example: In a basketball court there is a net. Whenever someone shoots and it goes inside the net, the ball will activate the sound and will be played. The problem is I want the sound to be only played for 5 seconds. The timelength of the sound is 223 seconds. The TimePosition is set at ### ### ##### came with this script ( chaching is the sound name): function onTouched(hit) script.Parent.Chaching:play() end script.Parent.Touched:connect(onTouched) I just want the sound to stop playing after 5 seconds but it won't because the timelength is 223 seconds which means the song will still be playing for about 100+ more seconds.
Report Abuse
dope_broskii is not online. dope_broskii
Joined: 20 Mar 2011
Total Posts: 160
17 Apr 2017 05:25 PM
Example: In a basketball court there is a net. Whenever someone shoots and it goes inside the net, the ball will activate the sound and will be played.

The problem is I want the sound to be only played for 5 seconds.

The TimeLength of the sound is 223 seconds.

The TimePosition is set at 50

The model came with this script ( chaching is the sound name):


function onTouched(hit)
script.Parent.Chaching:play()
end
script.Parent.Touched:connect(onTouched)


I just want the sound to stop playing after 5 seconds but it won't because the timelength is 223 seconds which means the song will still be playing for about 100+ more seconds.
Report Abuse
Numak is not online. Numak
Joined: 12 Jan 2017
Total Posts: 151
17 Apr 2017 05:27 PM
Good scripting but why don't you make it so when you make it you stay there for 100 seconds ;-;
Report Abuse
dexperaux is not online. dexperaux
Joined: 18 Dec 2013
Total Posts: 153
17 Apr 2017 05:28 PM
function onTouched(hit)
script.Parent.Chaching:play()
wait(5)
script.Parent.Chaching:Stop()
end
script.Parent.Touched:connect(onTouched)

Report Abuse
Xenla is not online. Xenla
Joined: 31 Oct 2009
Total Posts: 319
17 Apr 2017 05:29 PM
wait(5) then
musicid = nil
Report Abuse
vexieh is not online. vexieh
Joined: 22 Oct 2009
Total Posts: 3468
17 Apr 2017 05:30 PM
^ Cute beginner
Sound:Play()
wait(5)
Sound:Stop()


Report Abuse
Xenla is not online. Xenla
Joined: 31 Oct 2009
Total Posts: 319
17 Apr 2017 05:30 PM
gonna smacku i mean- hug you
Report Abuse
dope_broskii is not online. dope_broskii
Joined: 20 Mar 2011
Total Posts: 160
17 Apr 2017 05:43 PM
Thank you, everyone who was involved with this post, the script successfully turned out how I wanted it to be. I also learned something from this.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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