Cythris
|
  |
| Joined: 12 Jul 2013 |
| Total Posts: 73 |
|
|
| 19 Jul 2017 12:44 AM |
local sound1 = 88#########local sound2 = 32#########local sound3 = 54#########local sound4 = 41#########local sound5 = 61#########local sound6 = 84#########local sound7 =859998992 local sound8 = 53######### 53#########local music = script.parent
while true do wait() music.soundid = "rbxassetid://"..soundid1 music:play() music.ended:wait()
music.soundid = "rbxassetid://"..soundid2 music:play() music.ended:wait()
music.soundid = "rbxassetid://"..soundid3 music:play() music.ended:wait()
music.soundid = "rbxassetid://"..soundid4 music:play() music.ended:wait()
music.soundid = "rbxassetid://"..soundid5 music:play() music.ended:wait()
music.soundid = "rbxassetid://"..soundid6 music:play() music.ended:wait()
music.soundid = "rbxassetid://"..soundid7 music:play() music.ended:wait()
music.soundid = "rbxassetid://"..soundid8 music:play() music.ended:wait()
end
It says soundid1 is a nil value, I've tried changing it but nothing. Can someone tell me what to change it to, or give me the correct script? Please help!
Cythris |
|
|
| Report Abuse |
|
|
ghulty
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 42 |
|
|
| 19 Jul 2017 12:48 AM |
http://wiki.roblox.com/index.php?title=API:Class/Sound
SoundId |
|
|
| Report Abuse |
|
|
Cythris
|
  |
| Joined: 12 Jul 2013 |
| Total Posts: 73 |
|
| |
|
Cythris
|
  |
| Joined: 12 Jul 2013 |
| Total Posts: 73 |
|
|
| 19 Jul 2017 12:53 AM |
01:51:46.659 - Workspace.Sound.Script:16: attempt to concatenate global 'soundId' (a nil value)
|
|
|
| Report Abuse |
|
|
ghulty
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 42 |
|
|
| 19 Jul 2017 12:53 AM |
| Lots of your script is hashed so I can't test myself, but you seem to be ignoring that Lua is case sensitive. Correct all of your property and methods to the capitalized versions that are on that wiki page and I think it would work. |
|
|
| Report Abuse |
|
|
Cythris
|
  |
| Joined: 12 Jul 2013 |
| Total Posts: 73 |
|
|
| 19 Jul 2017 12:58 AM |
By case sensitive, what must and must not be cap'd?
|
|
|
| Report Abuse |
|
|
|
| 19 Jul 2017 01:01 AM |
soundid to SoundId play to Play ended to Ended
-- roblox chat syst## |
|
|
| Report Abuse |
|
|
Cythris
|
  |
| Joined: 12 Jul 2013 |
| Total Posts: 73 |
|
|
| 19 Jul 2017 01:05 AM |
My main problem is the god damn nil value. Even after changing it, it tstill says it's a nil value.
|
|
|
| Report Abuse |
|
|
|
| 19 Jul 2017 01:08 AM |
| Change soundid1 to sound1. You have vars defined as sound1 to sound8 and you're using soundid1 to soundid8 |
|
|
| Report Abuse |
|
|
Cythris
|
  |
| Joined: 12 Jul 2013 |
| Total Posts: 73 |
|
|
| 19 Jul 2017 01:13 AM |
that soundid is not a vlaid member of sound
|
|
|
| Report Abuse |
|
|
Cythris
|
  |
| Joined: 12 Jul 2013 |
| Total Posts: 73 |
|
| |
|
FPSPwnz0r
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 2737 |
|
|
| 19 Jul 2017 01:26 AM |
Use a table
local sounds = {workspace.Sound9, workspace.Sound9, workspace.Sound9Large...}
function poop() for i,v in pairs(sounds) do v:Play() wait(v.TimeLength) end end
while true do poop() end
I think this works
R$1 |
|
|
| Report Abuse |
|
|
FPSPwnz0r
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 2737 |
|
|
| 19 Jul 2017 01:29 AM |
wait nvm
local sounds = {"rbxassetid://130783911", "rbxassetid://241178067", "rbxassetid://146320268", "workspace.Sound4"} local player = workspace.Sound
function poop() for i,v in pairs(sounds) do player.SoundId = v player:Play() wait(player.TimeLength) end end
while true do poop() end
R$1 |
|
|
| Report Abuse |
|
|
Cythris
|
  |
| Joined: 12 Jul 2013 |
| Total Posts: 73 |
|
|
| 19 Jul 2017 01:30 AM |
how exactly do I use that? (im new, sorry) and im trying to play multiple songs in a loop, like those club games
|
|
|
| Report Abuse |
|
|
nullfeels
|
  |
| Joined: 31 Mar 2017 |
| Total Posts: 1215 |
|
|
| 19 Jul 2017 02:31 AM |
There are certainly better ways to do this than repeating the same code over and over for every sound you want to play.
Why not put all of your sound files in a folder inside the workspace and call it Sounds or Songs or something. If you do not wish to pre-fetch the sound files then perhaps you could use a StringValue instead to store the path of each sound.
Then in your script you can get all of the sounds by simply doing this: local sounds = workspace.Sounds:GetChildren().
And to play your sounds you can use a for loop like so:
for i=1,#sounds do local path = sounds[i].Value local sound = Instance.new("Sound", script) sound.SoundId = path sound:Play() sound.Ended:wait() --uncomment if you wish to destroy the sound file after playing --sound:Destroy() end
This way when you want to add a new sound all you have to do is create a new StringValue in the workspace.Sounds folder and set the value to the id of the sound. You never have to touch the code again unless you want to update/modify it.
This is just one suggestion, there are many to do such things. |
|
|
| Report Abuse |
|
|