How can I make this elseif statement happen every time rather than once?

Thanks but that fixed the error not the issue

Well the while loop should have made it occur more than once

So do I use repeat? Or will I need to include an until for that?

Do you want is to repeat until something happens?

1 Like

no, I just want it to repeat every time the round ends

I never seen something like this :

spawn{roundTimer()}

but it work

spawn{roundTimer()}

is this some kind of old code ?

Im not sure what your talking about but it is not old

I typed the script a few weeks ago

i think i know how to enable playerGui back. All you need to do is set the GameInfo.Visible to false back

I don’t see you set the values that you check for back to the original, you might wanna check that because I believe that is why it’s not working yet giving no errors

this system was made by TheDevKing…

Yes, Im a bit new to scripting so I sometimes follow tutorials

If I set visible to false, that will defeat the purpose of the gui. It has a play button

Put something like this :

task.delay(5,function()
		player.PlayerGui.EndGui.GameInfo.Visible = false
		player.PlayerGui.EndGui.CameraHandler.Disabled = true
end)

Do I put it inside of the if statement?

Inside for loop after you set frame visible to true

The issue isnt fixed. I think it has something to do with the while loop or the if statement

well, try this code :

local roundlength = 15
local intermissionlength = 5
local InRound = game.ReplicatedStorage.InRound
local Status = game.ReplicatedStorage.Status
local Camera = workspace.CurrentCamera

local function Teleport(Location)
	if not workspace.Spawns:FindFirstChild(Location) then return end
	for _, player in pairs(game.Players:GetPlayers()) do
		local char = player.Character or player.CharacterAdded:wait()
		char.HumanoidRootPart.CFrame = workspace.Spawns[Location].CFrame + Vector3.new(0,5,0)
	end
end

InRound.Changed:Connect(function()
	if InRound.Value == false then 
		print(InRound.Value)
		Teleport("LobbyTP")
	else print(InRound.Value)
		Teleport("Arena") --CREATE A BASEPART CALLED ARENA INSIDE workspace.Spawns
	end
end)
local function roundTimer()
	while wait() do
		for i = intermissionlength, 0, -1 do
			InRound.Value = false
			wait(1)
			Status.Value = "INTERMISSION: ".. i ..""
			print(Status.Value)
		end
		for i = roundlength, 0, -1 do
			InRound.Value = true
			wait(1)
			Status.Value = "TIME: ".. i ..""
			print(Status.Value)
			if i <= 0 then
				Ended()
			end
		end
	end
end
spawn(roundTimer)
function Ended() print("Ended!")
	for _, player in pairs(game.Players:GetPlayers()) do
		pcall(function()--must put pcall for all player because certain playerGui might not loaded,the entire script can broken
			player.PlayerGui.EndGui.GameInfo.Visible = true
			player.PlayerGui.EndGui.CameraHandler.Disabled = false
			--also need to change back to default setting on server because it will not updated to client after frame visible already true but not actually visible 
			task.delay(5,function()
				player.PlayerGui.EndGui.GameInfo.Visible = false
				player.PlayerGui.EndGui.CameraHandler.Disabled = true
			end)
		end)
	end
end

1 Like

Thanks! this solved the issue, but the gui doesnt appear the second time. Only the script

well this work fine for me man :upside_down_face: