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: Sound won't play.

Previous Thread :: Next Thread 
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
08 Oct 2013 11:48 PM
sound.Play = function(name,id,volume,looped)
local song = Instance.new("Sound",game.Players.LocalPlayer)
song.Name = name
song.SoundId = "rbxassetid://"..id
song.Volume = volume
song.Looped = looped
song:Play()
end

local songs = {
Dubstep = {ID = "130768080", Volume = tonumber(settings.Volume.Value/100)},
ParamaPanorama = {ID = "131852078", Volume = tonumber(settings.Volume.Value/100)},
Freedom = {ID = "130760592", Volume = tonumber(settings.Volume.Value/100)},
Resis = {ID = "27697234", Volume = tonumber(settings.Volume.Value/100)},
ElevatorMusic = {ID = "130768299", Volume = tonumber(settings.Volume.Value/100)}
}

sound.Play(settings.GameMusic.Value,songs[settings.GameMusic.Value].ID,1,true)

The sound shows up where it should with the properties that it should, it just doesn't play.
Report Abuse
nooblits2199 is not online. nooblits2199
Joined: 21 Feb 2009
Total Posts: 2970
08 Oct 2013 11:56 PM
Thanks for telling me that. What else do you have to complain about?
Report Abuse
Usering is online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
08 Oct 2013 11:58 PM
sound = {Play = function(name,id,volume,looped)
local song = Instance.new("Sound",game.Players.LocalPlayer)
song.Name = name
song.SoundId = "rbxassetid://"..id
song.Volume = volume
song.Looped = looped
song:Play()
end}

local songs = {
["Dubstep"] = {ID = "130768080", Volume = tonumber(settings.Volume.Value/100)},
["ParamaPanorama"] = {ID = "131852078", Volume = tonumber(settings.Volume.Value/100)},
["Freedom"] = {ID = "130760592", Volume = tonumber(settings.Volume.Value/100)},
["Resis"] = {ID = "27697234", Volume = tonumber(settings.Volume.Value/100)},
["ElevatorMusic"] = {ID = "130768299", Volume = tonumber(settings.Volume.Value/100)}
}

sound.Play(settings.GameMusic.Value,songs[settings.GameMusic.Value].ID,1,true)
Report Abuse
adark is not online. adark
Joined: 13 Jan 2008
Total Posts: 6412
09 Oct 2013 12:28 AM
You may be experiencing the issue that sounds won't Play until they are fully loaded, but they don't load until first Played. You can fix this using the Preload method of the ContentProvider service:

http://wiki.roblox.com/index.php/Preload_%28Method%29

Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
09 Oct 2013 04:00 PM
Tried the preload and modified script. Still doesn't work. I have now just done this:


local songs = {
Dubstep = {ID = "130768080", Volume = tonumber(settings.Volume.Value/100)},
ParamaPanorama = {ID = "131852078", Volume = tonumber(settings.Volume.Value/100)},
Freedom = {ID = "130760592", Volume = tonumber(settings.Volume.Value/100)},
Resis = {ID = "27697234", Volume = tonumber(settings.Volume.Value/100)},
ElevatorMusic = {ID = "130768299", Volume = tonumber(settings.Volume.Value/100)}
}
for i,v in pairs(songs) do
Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=" .. v.ID)
wait(1/10)
end

local song = Instance.new("Sound",game.Players.LocalPlayer)
song.Name = "GameSound"
song.SoundId = "http://www.roblox.com/asset/?id="..songs[settings.GameMusic.Value].ID
song.Volume = songs[settings.GameMusic.Value].Volume
song.Looped = true

Any other solutions?
Report Abuse
wally5026 is not online. wally5026
Joined: 28 Dec 2010
Total Posts: 503
09 Oct 2013 04:01 PM
try adding wait(5) for it to have time to load, if all else fails.
Report Abuse
chickenman158 is not online. chickenman158
Joined: 18 Jan 2011
Total Posts: 915
09 Oct 2013 04:06 PM
Try un-muting your speakers. Usually works for me.
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
09 Oct 2013 04:08 PM
That's what I was afraid of. It works.
Report Abuse
UnAdmin is not online. UnAdmin
Joined: 10 Jul 2012
Total Posts: 4706
09 Oct 2013 04:09 PM
huehue I tried adding the wait, not unmuting my speakers. Plus I am not using speakers, I have an HDMI cable hooked up to a 32" TV mounted above my monitor.
Report Abuse
funnymouse7 is not online. funnymouse7
Joined: 17 Mar 2011
Total Posts: 1741
09 Oct 2013 05:07 PM
I use to think I was like the only 1 from 10 people int he whole world who had that... now I realise im not special... lol
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