How to Make A Radio That Plays a Variety of Music?

Dear fellow developers.

Hello, it is me MrSavage261! I am developing a club for my game, and I cannot figure out how to make the radio :frowning: I am going to put the radio on a stage, and I would like a brick in the radio to play a list of music ( I have 30+) songs selected that I am going to add, and I need a scriot that will make the brick play all the songs, the repeat the script once all of the songs are finished :stuck_out_tongue: So can someone please write a simple script showing me how to do this! Thank you :smiley:

Sincerly, MrSavage261

6 Likes

This will randomly pick song IDs and then play them.
Make a table that includes the IDs of the songs (for example, local ids = {ID1,ID2,etc..}), then make a function that chooses a random ID from that table:
sound.SoundId = "rbxassetid://"..ids[math.random(#ids)]
And then play the sound. After you make the function, you must run it.
Now you want it to run this function when the song ends, which you can do so by:
sound.Ended:Connect(function()
randomize()
end)

Hope this helped.

1 Like

This script will loop through the SongList Infinitely.
Just replace the IDs in the table with your IDs.

local Sound = script.Parent:WaitForChild("Sound")
local SongsList = {"rbxassetid://1837324424", "rbxassetid://1845554017", "rbxassetid://1843463175"}

local function PlaySongs()
	for Index = 1, #SongsList do
		Sound.SoundId = SongsList[Index]
		Sound:Play()
		wait(Sound.TimeLength)
		if Index == #SongsList then
			PlaySongs()
		end
	end
end

PlaySongs()

I agree with @Sonnenroboter, Please do not ask people to write entire scripts. I did this as a one time courtesy.

12 Likes

Requests are not allowed in this category. If you try and have a problem, I’d love to help but I don’t spoonfeed. Give it 1 try, at least and don’t fear to ask when you’re stuck.

-Seonnenroboter

2 Likes

I am sorry I will not do this again. I am a medium scripter and I am not good with tables, and when I tried to do this the script would not work, but thank you :smiley:

2 Likes

So do I put this script in the brick? Because, I need a script that goes in a brick for the radio model.

Yes, add that script to a brick with a Sound named “Sound” Inside the Part.

1 Like