So basically I have this game round script that loops and I'm trying to make it choose a random song for the intermission. The problem is that the script chooses a song then automatically chooses another one without going through the round.
Here is the script:
local replicatedstorage = game:GetService("ReplicatedStorage")
local status = replicatedstorage:WaitForChild("StatusValue")
while true do
-- Intermission
for i = 30,0,-1 do
status.Value = "INTERMISSION: "..i
wait(1)
Song = Instance.new("Sound")
Song.Parent = workspace
Song.Volume = 1
Song.Looped = false
Assets = {274504661,263966756,346191865}
for _, asset in ipairs(Assets) do
game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id=" .. asset)
end
Song.SoundId = "http://www.roblox.com/asset/?id=" ..Assets[math.random(1,#Assets)]
Song:Play()
end
-- Round
for i = 100,0,-1 do
status.Value = "TIME LEFT: "..i
wait(1)
end
status.Value = "GAME OVER"
wait(1)
end
