i get these errors while randomly litening to the radio:
No reason it happened, and idk whats wrong.
heres the script for it:
local Screen = script.Parent.Screen.SurfaceGui
local PP = script.Parent["Pause/Play"]
local Vol = script.Parent.Volume
local StationButton = script.Parent.Station
local Songs = script.Parent.Main.RadioMusic
local Station = "Classics"
local StationSong = ""
local On = false
local PlaceSender = game.ReplicatedStorage:WaitForChild("PlaceSender")
local PausedVar = script.Parent["Pause/Play"].Paused
local Next = Songs.PlayNext
PlaceSender.OnServerEvent:Connect(function(plr, Param, Type, RemFrom)
if Param == "Removed" then
if Type.Name == "Radio" then
print("Radio Removed")
Screen.Enabled = false
end
if Type.Name == "BatInUse" then
print("Battery Removed")
Screen.Enabled = false
end
end
end)
StationButton.ClickDetector.MouseClick:Connect(function()
if On == true then
local MathRand = math.random(1, 5)
if MathRand == 1 then
Station = "Classics"
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
local ClonedSong = Songs[Station].CSong.Value:Clone()
Screen.Frame["SongName"].Text = ClonedSong.Name
Screen.Frame["Station Name"].Text = Station
ClonedSong.Parent = script.Parent.Main
ClonedSong.Name = "Song"
ClonedSong.Volume = 0.2
ClonedSong.RollOffMaxDistance = 150
elseif MathRand == 2 then
Station = "Intense FM"
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
local ClonedSong = Songs[Station].CSong.Value:Clone()
Screen.Frame["SongName"].Text = ClonedSong.Name
Screen.Frame["Station Name"].Text = Station
ClonedSong.Parent = script.Parent.Main
ClonedSong.Name = "Song"
ClonedSong.Volume = 0.2
ClonedSong.RollOffMaxDistance = 150
elseif MathRand == 3 then
Station = "98.1 RBLRAD"
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
local ClonedSong = Songs[Station].CSong.Value:Clone()
Screen.Frame["SongName"].Text = ClonedSong.Name
Screen.Frame["Station Name"].Text = Station
ClonedSong.Parent = script.Parent.Main
ClonedSong.Name = "Song"
ClonedSong.Volume = 0.2
ClonedSong.RollOffMaxDistance = 150
elseif MathRand == 4 then
Station = "Goofy Tunes FM"
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
local ClonedSong = Songs[Station].CSong.Value:Clone()
Screen.Frame["SongName"].Text = ClonedSong.Name
Screen.Frame["Station Name"].Text = Station
ClonedSong.Parent = script.Parent.Main
ClonedSong.Name = "Song"
ClonedSong.Volume = 0.2
ClonedSong.RollOffMaxDistance = 150
elseif MathRand == 5 then
Station = "Terminax FM"
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
local ClonedSong = Songs[Station].CSong.Value:Clone()
Screen.Frame["SongName"].Text = ClonedSong.Name
Screen.Frame["Station Name"].Text = Station
ClonedSong.Parent = script.Parent.Main
ClonedSong.Name = "Song"
ClonedSong.Volume = 0.2
ClonedSong.RollOffMaxDistance = 150
end
end
end)
Screen:GetPropertyChangedSignal("Enabled"):Connect(function()
if Screen.Enabled == true then
On = true
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
local ClonedSong = Songs[Station].CSong.Value:Clone()
Screen.Frame["SongName"].Text = ClonedSong.Name
Screen.Frame["Station Name"].Text = Station
ClonedSong.Parent = script.Parent.Main
ClonedSong.Name = "Song"
ClonedSong.Volume = 0.2
ClonedSong.RollOffMaxDistance = 150
else
On = false
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
end
end)
Songs.CurrentSong[Station]:GetPropertyChangedSignal("Value"):Connect(function()
if On == true then
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
local ClonedSong = Songs[Station].CSong.Value:Clone()
Screen.Frame["SongName"].Text = ClonedSong.Name
Screen.Frame["Station Name"].Text = Station
ClonedSong.Parent = script.Parent.Main
ClonedSong.Name = "Song"
ClonedSong.Volume = 0.2
ClonedSong.RollOffMaxDistance = 150
else
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
end
end)
PP.ClickDetector.MouseClick:Connect(function()
if script.Parent.Main:FindFirstChild("Song") then
if script.Parent.Main.Song.Volume == 0 then
script.Parent.Main.Song.Volume = 0.2
PausedVar.Value = "Playing"
else
script.Parent.Main.Song.Volume = 0
PausedVar.Value = "Paused"
end
end
end)
Next:GetPropertyChangedSignal("Value"):Connect(function()
if On == true then
for _, v in pairs(script.Parent.Main:GetChildren()) do
if v.Name == "Song" then
script.Parent.Main.Song:Destroy()
end
end
local ClonedSong = Songs[Station].CSong.Value:Clone()
Screen.Frame["SongName"].Text = ClonedSong.Name
Screen.Frame["Station Name"].Text = Station
ClonedSong.Parent = script.Parent.Main
ClonedSong.Name = "Song"
ClonedSong.Volume = 0.2
ClonedSong.RollOffMaxDistance = 150
end
end)
Thanks for any help!