Hello! So I've been trying to put a radio in one of my buildings using a free model stereo radio and it works just fine, but the problem is that at the end of every audio ID I play, a random jazz song starts playing. I want the radio to loop the ID instead of playing the jazz song. Here's the full script and tell me what should I remove/add to the script to make it work the way I want to:
SoundIDs = {926493242,408235742,387806727,662731104, 569084890,751005698} local button = script.Parent local enabled = button.Enabled local GUI = script.Parent.SurfaceGui local MUSIC = game.ReplicatedStorage:WaitForChild("MUSIC") local music = script.Parent.Parent:WaitForChild("Music") local MusicTime = script.Parent.Parent:WaitForChild("MusicLeft") local SoundIdMsg = music.SoundId local Time = 0 local SoundId = music.SoundId local InfinitePlay = script.Parent.Parent:WaitForChild("InfinityPlay") button.ClickDetector.MouseClick:connect(function(player) if enabled.Value == true then script.Parent.Pop:Clone().Parent = player.PlayerGui end end) MUSIC.OnServerEvent:connect(function(player, MusicID) music.Playing = false music:Stop() music.SoundId = "rbxassetid://"..MusicID GUI.TextLabel.Text = MusicID wait(2) InfinitePlay.Value = true music:Play() music.Playing = true PlayJazzSong() end) ------ RETURN TO JAZZ LOL --------- function clickit() music.Playing = false wait(1) print(SoundIDs[math.random(1,#SoundIDs)]) music.SoundId = "rbxassetid://"..SoundIDs[math.random(1,#SoundIDs)].."" music:Play() --- music.Looped = true InfinitePlay.Value = true music.Playing = true PlayJazzSong() end function clickit() music.Playing = false wait(1) print(SoundIDs[math.random(1,#SoundIDs)]) music.SoundId = "rbxassetid://"..SoundIDs[math.random(1,#SoundIDs)].."" music:Play() --- music.Looped = true InfinitePlay.Value = true music.Playing = true PlayJazzSong() end --- music.Changed:connect(function(Message) --- print(Message) function PlayJazzSong() if InfinitePlay.Value == true then repeat wait(1) until music.TimeLength ~= nil Time = music.TimeLength wait(0.2) if music.Volume ~= 1 then ----- COME IN ----- music.Volume = 1 end print("SONG STARTING!",Time) if Time ~= 0 then MusicTime.Value = Time - 3 wait(0.3) Time = music.TimeLength else MusicTime.Value = 60 end ---- PLAYING TIME ------ music.Playing = true repeat wait(1) if music.Playing ~= false then MusicTime.Value = MusicTime.Value -1 print ("Song ends in: "..MusicTime.Value) elseif music.Playing == false then print("MUSIC STOPPED PLAYER PAUSED") MusicTime.Value = 0 InfinitePlay.Value = false break end until MusicTime.Value <= 0 ---local MusicVol = music.Volume ---- FADE OUT ---- repeat if music.Volume <= 1 then music.Volume = music.Volume - 0.05 else music.Volume = music.Volume + 0.05 end wait(0.1) until music.Volume == 0 ---music:Stop() ---- New Random Jazz ---- if InfinitePlay.Value == true then clickit() print("CHOOSING JAZZ SONG!") end else print("RESTART MUSIC PLAYER [INFINITY MUSIC OFF]") end end
And also the radio model in case you want to see for yourself.
Discord: DogeMaximum#6951