while wait() do
if script.Parent.Value == 1 then
	map = game.ServerStorage.map
	cmap = map:Clone()
	cmap.Parent = workspace 
	
end
wait()
end
--------------------------------------------------------------------------------------------------------------------
while wait() do
	if script.Parent.Parent.Ended.Value == 1 then 

for i = 5,0, - 1 do
	local Text = script.Parent
	local Frame = script.Parent.Parent 
	Text.Text = i
	wait(1)
	if i == 0 then
		script.Parent.Parent.Ended.Value = 0
		spawnmap = game.Workspace.Spawnmap
		spawnmap.Value = 1 
		Text.Visible = false
		Frame.TextBox2.Text = "Map Spawning.."
		wait(3)
		Frame.TextBox2.Text = "Time left in game"
		Text.Visible = true
		local target = game.Workspace.thing.Position
		local player = game.Players.LocalPlayer
		Num = (math.random (0,game.Players.NumPlayers))
		
		if player.Shop.Value == 0 then
		player.Character:MoveTo(target)
	Min = 0
	Sec1 = 0
	Sec  = 0 -- both should start at 0 
	Text.Text = Min..":"..Sec1..Sec
	for i = 0,0,-1 do
		wait(1)
		print(i)
		end
		Text.Text = Min..":"..Sec1..Sec 	
		 else
			Sec = Sec - 1 
			if Sec == -1 then
				Sec1 = Sec1 - 1 
				Sec = 9
			
			end
		Text.Text = Min..":"..Sec1..Sec
		end
	end
end

	end
end