Now I do understand the the error is a way for Roblox to stop long running scripts, but what I don't understand is what in my script is causing it and how can I fix it?
--The purpose of the script is to play music while a main menu is on.
--The Boolean in ReplicatedStorage is to let the script know if the MainMenu is on or off
--I could have used the Visible property itself but I thought it would be more cleaner to use that.
local Menu = script.MenuMusic
local MenuBool = false
local Lobby = script.LobbyMusic
local LobbyBool = false
while true do
if game.ReplicatedStorage.StartMenu == true and MenuBool == false then
Menu:Play()
MenuBool = true
elseif game.ReplicatedStorage.StartMenu == false and LobbyBool == false then
Menu:Stop()
Lobby:Play()
LobbyBool = true
end
end

1 comment
This while loop will prevent any other scripts from running as it never yield(waits) I am also not sure why you even need a loop?