I made a radio but the issue is it only check if one sound is playing. I think anyways that’s what’s happening. I only want it to play one audio at a time but it keeps trying to play multiple or restarts the one already playing. Someone said I should index IsPlaying properties but I have no idea how to do that and looking at other dev forums I cant make sense of it.
code
local joey = true
while joey do
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Sound") then
local joe = math.random(1, 3)
print(joe)
if v.Playing == false then
if joe == 1 then
script.Parent.HardRockMadness:Play()
print("playing rock madness")
end
if joe == 2 then
script.Parent["Fallschirmjäger"]:Play()
print("Playing fallschrimjager")
end
if joe == 3 then
script.Parent.RockStyle:Play()
print("Playing RockStyle")
end
wait(10)
end
end
end
end
function checkIfPlaying(model)
for _,v in pairs(model:GetChildren()) do
if v:IsA(“Sound”) and v.IsPlaying then
return true
end
end
return false
end
local soundsArePlaying = checkIfPlaying(script.Parent)
function checkIfPlaying()
for _,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Sound") and v.IsPlaying then
return true
end
end
return false
end
local soundsArePlaying = checkIfPlaying(script.Parent)
local joey = true
while joey do
checkIfPlaying()
if soundsArePlaying == false then
local joe = math.random(1, 3)
print(joe)
if joe == 1 then
script.Parent.HardRockMadness:Play()
print("playing rock madness")
end
if joe == 2 then
script.Parent["Fallschirmjäger"]:Play()
print("Playing fallschrimjager")
end
if joe == 3 then
script.Parent.RockStyle:Play()
print("Playing RockStyle")
end
wait(10)
end
end
function checkIfPlaying()
for _,v in pairs(script.Parent:GetChildren()) do
if v:IsA("Sound") and v.IsPlaying then
return true
end
end
return false
end
local joey = true
while wait() do
local soundsArePlaying = checkIfPlaying(script.Parent)
if soundsArePlaying == false then
local joe = math.random(1, 3)
print(joe)
if joe == 1 then
script.Parent.HardRockMadness:Play()
print("playing rock madness")
end
if joe == 2 then
script.Parent["Fallschirmjäger"]:Play()
print("Playing fallschrimjager")
end
if joe == 3 then
script.Parent.RockStyle:Play()
print("Playing RockStyle")
end
wait(10)
end
end