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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Is playing/preload [while true do]

Previous Thread :: Next Thread 
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 11:10 AM
Hi, I have this music player:


while true do
wait() -- Lets the computer know that it can take it's time.
script.part1:Play()
wait(120)
script.Part2:Play()

end

Its not very efficient and it takes a while to load.


I have 2 parts of a song, I need them to play seamlessly to together and this isn't working out to well.
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 11:12 AM
ee
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
27 Mar 2014 11:12 AM
You can have them both in loop and just change the volume
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 11:13 AM
how would I go about doing that?
Report Abuse
brandon58590 is not online. brandon58590
Joined: 08 Mar 2008
Total Posts: 996
27 Mar 2014 11:13 AM
First of all the wait() after the while really won't make a difference since it only waits 1/30th of a second. Have you tried playing with the second wait to make the two tracks match up?
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 11:15 AM
@brandon

but it has to load the other song and loading times are always different.


How could I do the pre-load function
Report Abuse
fireblade2 is not online. fireblade2
Joined: 18 Nov 2007
Total Posts: 4666
27 Mar 2014 11:16 AM
Sound1:Play()

while not Sound1.IsPaused do --Not sure if Sound1.IsPlaying would work the same
wait(1/30)
end

Sound2:Play()
Report Abuse
brandon58590 is not online. brandon58590
Joined: 08 Mar 2008
Total Posts: 996
27 Mar 2014 11:17 AM
I've never really played much with sounds so I may not be the best person to help, if this problem is fixable. After the first time the song is played is the loading time of the song shortened for every other time the same song is played?
Report Abuse
fireblade2 is not online. fireblade2
Joined: 18 Nov 2007
Total Posts: 4666
27 Mar 2014 11:19 AM
To preload, use this:

game:GetService("ContentProvider"):Preload(Sound1.SoundId)
game:GetService("ContentProvider"):Preload(Sound2.SoundId)



With the new roblox update, a sound will not play until it is fully loaded. It will wait until it is loaded first. You may want to wait a few seconds before playing the sounds.
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 11:19 AM
@Fire

your script won't even play
Report Abuse
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
27 Mar 2014 11:22 AM
@EncryptedZ
Because theres no part of it that actually plays the sound.
What he posted is for making the sound load before it plays, so when you play it you won't have to wait until it loads.

~The herp lerped a derp~
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 11:23 AM
@flip, I was talking about his earlier post.


not the preload function
Report Abuse
fireblade2 is not online. fireblade2
Joined: 18 Nov 2007
Total Posts: 4666
27 Mar 2014 11:25 AM
I wrote "Sound1" and "Sound2" for my own convenience. It was implied that you need to add script.Parent before each, or somehow index your two sounds first. Also, if you did do that, read the output
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 11:28 AM
@Fire.


Yeah it plays the first part.

But for Sound2 it doesn't play.
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 11:29 AM
Sound1 plays fine.


But Sound2 doesn't play at all.
Report Abuse
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
27 Mar 2014 11:30 AM
@EncryptedZ
Sorry, didn't realize that.
His script would work though, but you have to define "Sound1" and "Sound2".
There's no sort of magic that automatically makes the computer know what you mean when you tell it something. You have to tell it EXACTLY what to do.

~The herp lerped a derp~
Report Abuse
fireblade2 is not online. fireblade2
Joined: 18 Nov 2007
Total Posts: 4666
27 Mar 2014 11:31 AM
while Sound1.IsPlaying do
wait(1/30)
end

Sound2:Play()

Replace the lower half with this, and if this doesn't work, there's no way to do it. It means roblox did not yet fix these properties of their sounds.
Report Abuse
filiptibell is online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
27 Mar 2014 11:31 AM
Mother of slow internet ninjas

~The herp lerped a derp~
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 11:33 AM
@Fire

I'll see if it works
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 01:18 PM
Yeah, it doesnt work


first part plays but not second
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 01:21 PM
qqqqqqqqqqqqq
Report Abuse
EncryptedZ is not online. EncryptedZ
Joined: 02 Jun 2013
Total Posts: 1646
27 Mar 2014 01:23 PM
hhhhhhhhhhhhhh
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