I've ran into an annoying issue with my Countdown GUI. The script is supposed to count down how many seconds until a new minigame is chosen. However, the script stops working after it waits for 3 seconds. I did not run into this issue before I moved the script to a new place instance.
local MainBar = game.StarterGui:FindFirstChild("MainBar") --------------- local MainBarFrame = MainBar:FindFirstChild("MainBarFrame") --------------- local MainBarText = MainBarFrame:FindFirstChild("MainBarText") --------------- local Minigames = game.ReplicatedStorage.Minigames:GetChildren() --------------------------------------- MainBarText.Text = "Get ready for the next minigame!" wait(3) for i = 15,0,-1 do --How much time is left until the next minigame MainBarText.Text = "Next minigame in " .. i .. " seconds!" wait(1) if i == 0 then MainBarText.Text = "Choosing a minigame..." Minigame = Minigames[math.random(1,#Minigames)]:Clone() Minigame.Parent = game.workspace MainBarText.Text = "Minigame: " .. Minigame.MinigameName.Value .. " by " .. Minigame.MinigameCreator.Value .. ""
This is what the Output told me:
16:40:55.368 - MainBar is not a valid member of PlayerGui
16:40:55.369 - Script 'Players.Player.PlayerGui.GameScript', Line 7
16:40:55.369 - Stack End
I don get this glitch, but I fixed your script (it didn't work, anyway, so I made a new feature to change it for every player because StarterGui is like the StarterPack of GUIs):
local Minigames = game.ReplicatedStorage.Minigames:GetChildren() function changeText(text) local p = game.Players:GetChildren() for i = 1,#p do local MainBar = p[i].PlayerGui:FindFirstChild("MainBar") local MainBarFrame = MainBar:FindFirstChild("MainBarFrame") local MainBarText = MainBarFrame:FindFirstChild("MainBarText") MainBarText.Text = text end end changeText("Get ready for the next minigame!") wait(1) for i = 0,15,1 do --How much time is left until the next minigame print(i) changeText("Next minigame in " .. 15 - i .. " seconds!") wait(1) if i == 15 then changeText("Choosing a minigame...") Minigame = Minigames[math.random(1,#Minigames)]:Clone() Minigame.Parent = game.workspace changeText("Minigame: " .. Minigame.MinigameName.Value .. " by " .. Minigame.MinigameCreator.Value) end end