Loop skipping parts of script?

while true do
local ATime = 30
while ATime > 0 do
	wait(1)
	ATime = ATime - 1
	print(ATime)
	game.ReplicatedStorage["RFs&REs"].Timer:FireAllClients(ATime)
end
	
print("Getting the gamemode")
GML = {"Original","Omega's Call","Clone","Power Outage"}
SGM = math.random(#GML)
GM = GML[SGM]

print("Getting the model")
local A = game.ReplicatedStorage.Abnormalities
local LOA = game.ReplicatedStorage.Abnormalities:GetChildren()
local CA = math.random(#LOA)
print(LOA[CA])

for i,RA in pairs(LOA) do
	if LOA[CA] == RA then
		print("Successful find!")
		RA.Parent = workspace
		Abnorm = RA
	end
end

script.AData.Event:Connect(function(NName,NIntro,NATime,NRank,NPic)
	print(NATime)
	print(NName)
	print(NIntro)
	print(NRank)
	game.ReplicatedStorage["RFs&REs"].MD:FireAllClients(NName,NIntro,NRank,NPic, GM)

		while NATime > 0 do
		wait(1)
		NATime = NATime - 1
		print(NATime)
		game.ReplicatedStorage["RFs&REs"].Timer:FireAllClients(NATime)
		end
	Abnorm.Parent = game.ReplicatedStorage.Abnormalities
end)
end

Near the end of the loop, the loop plays but the current loop but also restarts as well, why is this happening? shouldn’t the loop wait until the secondary loop is finished before continuing? the first look did run so i don’t get it

1 Like

Nevermind, solved it myself by using some hacky solution