How can I make a gui pop up when the timer reaches 0?

  • What does the code do and what are you not satisfied with?
    This script creates a round timer which teleports players when the time ends but I would like it to make a gui pop up when the timer reaches 0
  • What potential improvements have you considered?
    I tried using a function and an if statement
  • How (specifically) do you want to improve the code?
    I would like the ended function to make a gui pop up when the timer reaches 0
local roundlength = 300
local intermissionlength = 0
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local Camera = workspace.CurrentCamera

InRound.Changed:Connect(function()
	if InRound.Value == true then
		for _, player in pairs(game.Players:GetChildren()) do
			local char = player.Character
			char.HumanoidRootPart.CFrame = workspace.Spawns.LobbyTP.CFrame
		end
	end
end)

local function roundTimer()
	while wait() do
		for i = intermissionlength, 0, -1 do
			InRound.Value = false
			wait(1)
			Status.Value = "TIME: ".. i ..""
		end
		for i = roundlength, 0, -1 do
			InRound.Value = true
			wait (1)
			Status.Value = "TIME: ".. i ..""
		end
	end
end

spawn{roundTimer()}

local function Ended()
	if Status.Value == 0 then
		game.StarterGui.EndGui.GameInfo.Visible = true
		game.StarterGui.EndGui.CameraHandler.Disabled = false
	end
end

Currently your ended function is modifying the startergui. Remember that the player has it’s own playergui and modifying the startergui won’t affect the playergui until the player respawns.

You should try to loop through the players and modify the guis in each player’s playergui. Or better yet, fire an event for all clients and have a client script show the gui

in the InRound.Changed function?

I dont know how to use remote events

Then you can read up a bit to learn about them:

I made a function doing what you said but it doesn’t work and also doesn’t display an error

‘’’
local function End()
if InRound.Value == false then
for _, player in pairs(game.Players:GetChildren()) do
local playerGui = player:FindFirstChild(“PlayerGui”)
if playerGui then
local EndGui = playerGui.EndGui
local GameInfo = EndGui.GameInfo
local CameraHandler = EndGui.CameraHandler
GameInfo.Visible = true
CameraHandler.Disabled = false
end
end
end
end
‘’’