There's this script that I want to modify it; when you click the button, it plays music but how can I make it so it plays different songs along with it too like a playlist? Here's the script;
bin = script.Parent function Clicked() bin.Parent.Sound.SoundId = "rbxassetid://142372565" bin.Parent.Sound:Play() wait(125) end bin.MouseButton1Down:connect(Clicked)
Also is it possible that I can remove the
wait(125)
part and make it so that it automatically changes into another song once it ends without having to specifically count 125 seconds?
If I am thinking correctly this is what you want.
local bin = script.Parent --Create a table to store all your songs local songs = { 'rbxassetid://142372565', 'rbxassetid://54654', 'rbxassetid://233', 'rbxassetid://123', 'rbxassetid://asd', 'rbxassetid://ds', 'rbxassetid://djdjdj', } -- Clicked Event bin.MouseButton1Down:connect(function() bin.Parent.SoundId = tostring(songs[math.random(1, #songs)]) --Picks a random song from table bin.Parent.Sound:Play() wait(bin.Parent.Sound.TimeLength) end)
However, if you want it to play forever then do this
bin.MouseButton1Down:connect(function() while true do wait() bin.Parent.SoundId = tostring(songs[math.random(1, #songs)]) --Picks a random song from table bin.Parent.Sound:Play() wait(bin.Parent.Sound.TimeLength) end) end