I made a script to rotate lobby music thrice and then swap a song, a long with a gui text. All music is stored in workspace.Music and my GUI is properly in the startergui. This is my script, any help is appreciated.
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local gui = player:WaitForChild("PlayerGui"):WaitForChild("Songslist"):WaitForChild("Songs")
local song1 = workspace.Music:FindFirstChild("Time")
local song2 = workspace.Music:FindFirstChild("Solaris")
local song3 = workspace.Music:FindFirstChild("Flowers")
local song4 = workspace.Music:FindFirstChild("Annoying")
local currentSong = song1 -- Set an initial song
while true do
if currentSong == song1 and currentSong.IsPlaying then
gui.Text = "Now Playing - Drifting Time Misplaced (8-BIT EDITION)"
wait(497.232)
currentSong:Stop()
currentSong = song2
currentSong:Play()
elseif currentSong == song2 and currentSong.IsPlaying then
gui.Text = "Solaris Daylight (Ray's Mod Edition)"
wait(357.213)
currentSong:Stop()
currentSong = song3
currentSong:Play()
elseif currentSong == song3 and currentSong.IsPlaying then
gui.Text = "Now playing - OMORI, A Home for Flowers"
wait(278.91)
currentSong:Stop()
currentSong = song4
currentSong:Play()
elseif currentSong == song4 and currentSong.IsPlaying then
gui.Text = "Now playing - OMORI, Whale Whale Whale"
wait(221.865)
currentSong:Stop()
currentSong = song1
currentSong:Play()
end
wait(1)
end
By the way, I multiplied the song length by three for the wait time.
All audios work but my script doesn’t and doesn’t return anything in console. Again, help is appreciated.