minigames = game.Lighting.Minigames:GetChildren()

 h = Instance.new("Hint", game.Workspace)

function removePlates()
	plates = game.Workspace.DissapearingPlates.Plates:GetChildren()
	ranNum1 = math.random(1,#plates)
	ranNum2 = ranNum1
	while ranNum2 == ranNum1 do
		ranNum2 = math.random(1, #plates)
		wait()
	end
	platesChosen = plates[ranNum1]
	platesChosen2 = plates[ranNum2]
	for i = 0, 1, 0.05 do
		plateChosen.Transparency = i
		plateChosen.Transparency = i
	    wait()
	end
	plateChosen:Destory()
	plateChosen2:Destory()	
end

 while true do 
	
	     if game.Players.NumPlayers > 0 then
		 h.Text = "Deciding what game to play"
		 wait(3)
		 ranGame = math.random(1,#minigames)
		 gameChosen = minigames[ranGame]
		 h.Text = "Minigames chosen: " .. gameChosen.Name
		 wait(3)
		 gameChosenClone = gameChosen:Clone()
		 gameChosenClone.Parent = game.Workspace
		 wait(3)
		 --Teleport people to map
		 spawns = gameChosenClone.Spawns:GetChildren()
		for i, v in pairs(game.Players:GetPlayers()) do
           name = v.Name
           
           	if check then
	          checkHumanoid = check:FindFirstChild("Humanoid")
	             if checkHumanoid then
                  check:MoveTo(spawns[i].Position)	
	          end
	       end
		end
		for i = 3, 1, -1 do 
		      h.Text = "Game begins in: "  .. i
		      wait()
		end 
		 --Countdown until the game ends
		 for I = 10, 1, -1. do
			h.Text = "Time left: " .. i
			wait(1)
		end
		
		if gameChosenClone.Name == "DissapearingPlates" then
			timeTillGameEnds = 20
			for i = timeTillGameEnds, 1, -1 do
				h.Text = "Time left: " .. i 
				removePlate() 
			end
		end

		
		h.Text = "Game ended!"
		wait(3)
		h.Text = "Giving points to players who won!"
        for i, v in pairs(game.Players:GetPlayers()) do
	
end
	      inGame = v:FindFirstChild("Ingame")
	       if inGame then
		   if inGame.Value == true then
	        v.leaderstats.Point.Value = v.leaderstats.Points.Value + 100
	       end 
       end	
		wait(3)
		gameChosenClone:Destory()
	 else 
		 h.Text = "There needs to be more than 0 players to start"
	end
	wait(1)
end

1 comment

2

Please edit your post to correct the formatting. In addition, you should describe your problem and include the exact error message.