How to remote npcs after 2 people join the game

Currently I’m trying to update my fighting game but,
I’m not sure how to remove npcs from my game after 2 people join the server!

local Players = game:GetService("Players")
local AmountOfPlayers = #Players:GetPlayers()

Players.PlayerAdded:Connect(function(Player)
      AmountOfPlayers = AmountOfPlayers + 1
end)

Players.PlayerRemoving:Connect(function(Player)
      AmountOfPlayers = AmountOfPlayers - 1
end)


while wait(5) then
if AmountOfPlayers < 1
--- remove the npcs
else if AmmountOfPlayers >1
--- spawn the npcs in
end
end

a while wait loop isn’t the best way to do it it works and is simple enough to modify and understand

i just threw that together it may or may not work