Hello!
I’m trying to make a car radio GUI but I’m having trouble. As I’m sure you’ll come to notice I am a terrible scripter. Apologies for the jumbled mess but I don’t know where to go from here
- The folder contains other folders which contain Audios. Blues would be the blues radio station, classic would be the classical, and so on.
This script is the ‘Change’ script, and it’s supposed to detect when the player clicks the button and then change the station. It only works as a seperate script, not in the other script though.
music = script.Parent.Parent.Parent.Music
play = {}
local playlist = music.Mute
current = script.Parent.Parent.Parent.Current
script.Parent.MouseButton1Click:Connect(function()
if current.Value == "Mute" then
current.Value = "Rock"
local playlist = music.Rock
else if current.Value == "Rock" then
current.Value = "Psyche"
local playlist = music.Psyche
else if current.Value == "Psyche" then
current.Value = "Easy"
local playlist = music.Easy
else if current.Value == "Easy" then
current.Value = "Folk"
local playlist = music.Folk
else if current.Value == "Folk" then
current.Value = "Disco"
local playlist = music.Disco
else if current.Value == "Disco" then
current.Value = "Static"
local playlist = music.Static
else if current.Value == "Static" then
current.Value = "Classic"
local playlist = music.Classic
else if current.Value == "Classic" then
current.Value = "Blues"
local playlist = music.Blues
else if current.Value == "Surf" then
current.Value = "Surf"
local playlist = music.Mute
end
end
end
end
end
end
end
end
end
end)
*This is the script ‘PlayStop’, it is intended to make the actual song turn on/off. There’s another button to mute but I’m fine scripting that.
local player = game.Players.LocalPlayer
music = script.Parent.Parent.Parent.Music
play = {}
function shuffleSongs()
for i = 1, #songs, 1 do
local index = math.random(1, #songs)
local x = play[i]
play[i] = play[index]
play[index] = x
end
end
isPlaying = script.Parent.Parent.Parent.isPlaying
shuffle = script.Parent.Parent.Parent.shuffle
current = script.Parent.Parent.Parent.Current
script.Parent.MouseButton1Click:Connect(function()
if current.Value == "Mute" then songs = music.Mute:GetChildren()
if current.Value == "Rock" then songs = music.Rock:GetChildren()
if current.Value == "Psyche" then songs = music.Psyche:GetChildren()
if current.Value == "Easy" then songs = music.Easy:GetChildren()
if current.Value == "Folk" then songs = music.Folk:GetChildren()
if current.Value == "Disco" then songs = music.Disco:GetChildren()
if current.Value == "Static" then songs = music.Static:GetChildren()
if current.Value == "Classic" then songs = music.Classic:GetChildren()
if current.Value == "Blues" then songs = music.Blues:GetChildren()
if current.Value == "Surf" then songs = music.Surf:GetChildren()
for i, v in pairs(songs) do
play[i] = v
end
local sound
if isPlaying.Value == false then
sound = nil
if shuffle.Value == true then
shuffleSongs()
end
isPlaying.Value = true
for i, v in pairs(play) do
if v and isPlaying.Value == true then
sound = v:Clone()
sound.Parent = player
sound:Play()
sound.Ended:Wait()
sound:Destroy()
end
end
isPlaying.Value = false
end
if isPlaying.Value == true then
sound = nil
if shuffle.Value == true then
shuffleSongs()
end
isPlaying.Value = false
player:FindFirstChildOfClass("Sound"):Destroy()
wait(1)
isPlaying.Value = true
for i, v in pairs(play) do
if v and isPlaying.Value == true then
sound = v:Clone()
sound.Parent = player
sound:Play()
sound.Ended:Wait()
sound:Destroy()
end
end
isPlaying.Value = false
end
end
end
end
end
end
end
end
end
end
end
end)