NPC script where they remove and respawn on a timer

Hey guys I am trying to make a script that spawns npcs on a certain position and remove npcs that exist then respawn. Here is what I have so far. I need help with creating a timer and looping it however.



function SpawnNPCS()
		local npcs = ents.Create("npc_zombie")
		npcs:SetPos(Vector(549.964661, 1500.438965, 49.031246))
		npcs:SetAngles(Angle(0, 225, 0))
		npcs:Spawn()
		npcs:DropToFloor()

		local npcs = ents.Create("npc_zombie")
		npcs:SetPos(Vector(6446.654, 545.345, 345.242))
		npcs:SetAngles(Angle(0, 225, 0))
		npcs:Spawn()
		npcs:DropToFloor()
end
hook.Add("InitPostEntity", "SpawnNPCS", SpawnNPCS)


I know this is a terrible way of doing it but I am not sure what other way I can. Thanks for any help in advanced!

Look at the

timer.Create page, it should help