I’m making a GTA 5-like car radio for my game, but stumbled accross a problem that I don’t know how to solve. In the radiomenu there’s 3 different texts being displayed, the top one displaying
the radiochannel, the second displaying the artist and the last displaying the song title.
When changing between the channels the same artist name and title name are displayed even though
changing the channel. I’ve come to the conclusion that the song which song that plays the first stays there til it’s done and then if another radio channel have changed song already the
menu displays the title and artist of that song instead. The toptext displaying the channelname works though.
Watch the video here:
Google Drive, video >CLICK HERE<
This is the top localscript in the “MusicOrder” folder. It basically changes the name of the song and artistname in the channel (as well as the name of the channel". This script is the one not functioning
local name = script.Parent.Parent.Parent.Song
local chl = script.Parent.Parent.Parent.Channel
local artist = script.Parent.Parent.Parent.Artist
local button = script.Parent.Parent
local playing = script.Parent.Parent.Parent.Parent.BillonPlaying.Value
local sound1 = script.Parent.Happening
local sound2 = script.Parent["Falling lights"]
local sound3 = script.Parent["Simple Beginning"]
local sound4 = script.Parent.Japan
local sound5 = script.Parent["My to you"]
local sound6 = script.Parent.Peace
local sound7 = script.Parent.Angelic
playing = false
chosen = false
chl.Text = "Nothing"
name.Text = "-"
artist.Text = "-"
button.MouseEnter:Connect(function()
button.ring.Visible = true
end)
button.MouseLeave:Connect(function()
button.ring.Visible = false
end)
button.MouseButton1Down:Connect(function()
button.Popup:Play()
if
playing == false
and
script.Parent.Parent.Parent.Parent.BillonPlaying.Value == false
and
chl.Text == "Nothing"
and
sound1.Volume == 0
and
sound2.Volume == 0
and
sound3.Volume == 0
and
sound4.Volume == 0
and
sound5.Volume == 0
and
sound6.Volume == 0
and
sound7.Volume == 0
and
chosen == false
then
playing = true
chosen = true
chl.Text = "Billon Ravers"
button.Switch:Play()
wait(1)
sound1.Volume = 0.5
sound2.Volume = 0.5
sound3.Volume = 0.5
sound4.Volume = 0.5
sound5.Volume = 0.5
sound6.Volume = 0.5
sound7.Volume = 0.5
elseif
playing == true
and
chl.Text == "Billon Ravers"
and
sound1.Volume == 0.5
and
sound2.Volume == 0.5
and
sound3.Volume == 0.5
and
sound4.Volume == 0.5
and
sound5.Volume == 0.5
and
sound6.Volume == 0.5
and
sound7.Volume == 0.5
and
chosen == true then
chl.Text = "Nothing"
playing = false
sound1.Volume = 0
sound2.Volume = 0
sound3.Volume = 0
sound4.Volume = 0
sound5.Volume = 0
sound6.Volume = 0
sound7.Volume = 0
chosen = false
end
end)
if chosen == true then
button.ring.Visible = true
elseif chosen == false then
button.ring.Visible = false
chl.Text = "Nothing"
name.Text = "-"
artist.Text = "-"
end
**This is the second localscript where the sound starts playing, they play all the time even though the volume is 0 and not only when the channel they belong to is on, therefore it is like a radio and not just a playlist that pauses when changing radiostation. I’ve tried to make it change name after every song and it kind of works but doesn’t disappear, like I said, if you change channel. **
local name = script.Parent.Parent.Parent.Song
local chl = script.Parent.Parent.Parent.Channel
local artist = script.Parent.Parent.Parent.Artist
local button = script.Parent.Parent
local sound1 = script.Parent.Happening
local sound2 = script.Parent["Falling lights"]
local sound3 = script.Parent["Simple Beginning"]
local sound4 = script.Parent.Japan
local sound5 = script.Parent["My to you"]
local sound6 = script.Parent.Peace
local sound7 = script.Parent.Angelic
while true do
sound1:Play()
name.Text = "Happening"
artist.Text = "No data"
sound1.Ended:Wait()
wait(2)
sound2:Play()
name.Text = "Falling Lights"
artist.Text = "Painted Skies & Viewer"
sound2.Ended:Wait()
wait(2)
sound3:Play()
name.Text = "Simple Beginnings"
artist.Text = "Fred V"
sound3.Ended:Wait()
wait(2)
sound4:Play()
name.Text = "カガミ"
artist.Text = "Akiba"
sound4.Ended:Wait()
wait(2)
sound5:Play()
name.Text = "My Love To You"
artist.Text = "A-live"
sound5.Ended:Wait()
wait(2)
sound6:Play()
name.Text = "inpeace"
artist.Text = "sewers"
sound6.Ended:Wait()
wait(2)
sound7:Play()
name.Text = "Angelic"
artist.Text = "Loretta"
sound7.Ended:Wait()
wait(2)
end
My goal with this project is to make a radio that plays the same audio for everyone (only if they’re on the same station). Right now the music starts locally when a player joins, meaning that a player that has been in the game for a longer time has a different song futher in the playlist than the person that has recently joined. I would wanna fix that in the future but I’m too scared I’m gonna break the whole thing.
I’m not so good at coding so I would appriciate if you could explain or maybe write some code down. If you need more information just comment and I’ll answer as soon as possible!
Sincerely, freak.