game.Players.PlayerRemoving:connect(function(player)
	print("Player leaving.")
	_G.SearchAndRemove(player)
	if #_G.PlayersInGame == 1 then
		print("1 player left.")
		script.Parent.Parent.Board.SurfaceGui.Frame.PrevWinner.Text = "Previous Winner: ".._G.PlayersInGame[1].Name
		_G.PlayersInGame[1].Character:MoveTo(script.Parent.Parent.Spawn.Position)
		_G.PlayersInGame[1].Character.Humanoid1.WalkSpeed = 16
		_G.PlayersInGame[1].leaderstats.Points.Value = _G.PlayersInGame[1].leaderstats.Points.Value + 10
		script.Parent.Parent.GameInProgress.Value = false
		table.remove(_G.PlayersInGame, 1)
		script.Parent.Parent.Spinner.Beam.CFrame = _G.DefaultPosbar
		script.Parent.Parent.Spinner.Circle.CFrame = _G.DefaultPoscircle
	elseif #_G.PlayersInGame == 0 then
		print("0 players left.")
		script.Parent.Parent.GameInProgress.Value = false
		script.Parent.Parent.Spinner.Beam.CFrame = _G.DefaultPosbar
		script.Parent.Parent.Spinner.Circle.CFrame = _G.DefaultPoscircle
	end
end)