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: RandomSong

Previous Thread :: Next Thread 
BlixBlocker is not online. BlixBlocker
Joined: 24 Dec 2013
Total Posts: 657
14 Jul 2015 01:38 PM
choices = script:GetChildren()
songs = #choices
randomsong = math.random(1,songs)

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)

end



How would I make it so it played one of those songs? (The song's parent is the script)
Report Abuse
DeathsLASTwords is not online. DeathsLASTwords
Joined: 28 Jan 2012
Total Posts: 2701
14 Jul 2015 01:41 PM
songid = '21345678','12345678' -- these are just examples

songpick = math.random(1,#songid)

songpick:Play(songpick)


this is just a really basic example. It would look something like that.
Report Abuse
BlixBlocker is not online. BlixBlocker
Joined: 24 Dec 2013
Total Posts: 657
14 Jul 2015 01:44 PM
that doesnt work
Report Abuse
DeathsLASTwords is not online. DeathsLASTwords
Joined: 28 Jan 2012
Total Posts: 2701
14 Jul 2015 02:03 PM
Read the post again. I said this is a basic example, and will not work.
Report Abuse
MisBloxy is not online. MisBloxy
Joined: 13 Sep 2008
Total Posts: 164
14 Jul 2015 02:09 PM
hai im back again... :D
here, this will help:

choices = script:GetChildren()
songs = #choices
randomsong = math.random(1,songs)

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
local song = choices[randomSong]:Clone()
song.Parent = --Put the song anywhere you want
end)
end)



Yay I did it :D
Report Abuse
BlixBlocker is not online. BlixBlocker
Joined: 24 Dec 2013
Total Posts: 657
14 Jul 2015 02:17 PM
Thank you miss, but I have a question.

If I die, the song doesn't stop playing, which is good, but then another song starts playing also.

How do I stop that?
Report Abuse
Fribet is not online. Fribet
Joined: 08 Feb 2014
Total Posts: 700
14 Jul 2015 02:25 PM
More scripting, use if statements and check if more then 1 are running.
Report Abuse
MisBloxy is not online. MisBloxy
Joined: 13 Sep 2008
Total Posts: 164
14 Jul 2015 02:28 PM
the song only stops playing if the song's parent is parented to the player backpack or starterGUI


Yay I did it :D
Report Abuse
MisBloxy is not online. MisBloxy
Joined: 13 Sep 2008
Total Posts: 164
14 Jul 2015 02:29 PM
oh yeah, wht he said. i didnt see wat u said at first.


Yay I did it :D
Report Abuse
BlixBlocker is not online. BlixBlocker
Joined: 24 Dec 2013
Total Posts: 657
14 Jul 2015 02:51 PM
I have another problem...
The song that just finished won't go to finished songs

script:

choices = script:GetChildren()
songs = #choices
randomsong = math.random(1,songs)

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
while true do
local song = choices[randomsong]
song.Parent = game.Workspace.CurrentSong --Put the song anywhere you want
song:Play()
wait(song.TimeLength)
song.Parent = game.Workspace.FinishedSong
end

end)
end)
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