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: Get variable from table?

Previous Thread :: Next Thread 
championbuilder is online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
27 Dec 2014 09:31 AM
So I have this, and song1, and song2 are different assets for audio.

while (true) do
local songs = {song1,song2}
local song = math.random(1,#songs)
print("Playing Sound"..song)
script.Off.Value = false
script.Song.Value = "Song"..song
wait(0.1)
music.SoundId = --[[How do I get the song variable here]]
music:play()
wait(120)
music:stop()
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
27 Dec 2014 09:36 AM
music.SoundId = "rbxasset://"..sound

Like that? Assuming the table elements are asset ids
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
27 Dec 2014 09:37 AM
Eh I think I'm still half asleep what am I doing. I mean this:

music.SoundId = "rbxasset://"..songs[song]
Report Abuse
championbuilder is online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
27 Dec 2014 09:43 AM
ty
Report Abuse
ChuckXZ is not online. ChuckXZ
Joined: 26 Jan 2012
Total Posts: 2996
27 Dec 2014 09:55 AM
You need to define the song's Id.
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