So i made a round script that has a timer and intermission, but once the timer starts, The intermission starts to play while the timer is counting down.

It overlaps the Status value i have in replicated storage that sends the value to my textlabel and starts to overwrite the text with:"5:00" and 0.1 seconds later, the text is "Intermission: 23"

i think the spawn function is breaking it but i don't know how to fix this and i am spawning it because i want other things to happen later on the in script like giving the killer their weapon, thats why i am printing "Hi" to make sure it works.

Here is my script:

local remoteFolder = game.ReplicatedStorage:WaitForChild("RemoteEvents")
local enableSprintRemote = remoteFolder:WaitForChild("EnableSprint")
local status = game.ReplicatedStorage:WaitForChild("Values"):WaitForChild("Status")
local timeInSeconds = 300
local timeInMinutes = math.floor(timeInSeconds/60)
local remainder = timeInSeconds % 60
local intermission = 30
local mapVoteTime = 15

local function intermissionTimer()
	for i = intermission, 0, -1 do
		wait(1)
		status.Value = "Intermission: "..i
	end
end

local function mapVoteTimer()
	for i = mapVoteTime, 0, -1 do
		wait(1)
		status.Value = "Vote for a map: "..i
	end
end

local function roundTimer()
	for i = 1,remainder do
		wait(1)
		if timeInMinutes > 9 then
			if remainder - i < 10 then
				status.Value = timeInMinutes..":0"..remainder-i
			else
				status.Value = timeInMinutes..":"..remainder-i
			end
		else
			if remainder - i < 10 then
				status.Value = "0"..timeInMinutes..":0"..remainder-i
			else
				status.Value = "0"..timeInMinutes..":"..remainder-i
			end
		end
	end
	
	for i = 1,timeInMinutes do
		for i = 1,60 do
			wait(1)
			if timeInMinutes > 9 then
				if 60 - i < 10 then
					status.Value = timeInMinutes..":".."0"..(60-i)
				else
					status.Value = timeInMinutes..":"..(60-i)
				end
			else
				if 60-i < 10 then
					status.Value = "0"..timeInMinutes..":0"..(60-i)
				else
					status.Value = "0"..timeInMinutes..":"..(60-i)
				end
			end
		end
		timeInMinutes = timeInMinutes-1
	end
end

--main
	local function main()
	intermissionTimer()
	wait(2)
	mapVoteTimer()
	wait(2)
	status.Value = "Getting the chosen map..."
	wait(2)
	status.Value = "Teleporting Players!"
	local plrs = game.Players:GetChildren()
	for i = 1,#plrs do
		local telePoint = workspace.Teleports:GetChildren()
		local randTele = math.random(1,#telePoint)
		plrs[i].Character:MoveTo(telePoint[randTele].Position)
	end
	wait(0.5)
	spawn(roundTimer)
	wait(5)
	print("Hi")
	end
--mainClose

while wait(0) do
	main()
end

contact me if you need more info!

Here is the game so you can see what i am talking about: https://web.roblox.com/games/5303228608/Downtime-Testing

1 comment

0

That's probably because you spawn(roundTimer) so the code below that line doesn't wait for it to finish running