Hello all, I am creating an RPG game, and have been coming into difficulty when making my "Monster" or enemy NPC's!

So, my only issue I've run into is this "respawn" script, where, it detects when the humanoids health is less than 1, and then respawns them via :clone and :MakeJoints()

The code respawns the NPC correctly, and at the point of placement in workspace, BUT, my trouble is I am trying to make him respawn after a certain time period, and was wondering where/how I would go about coding this inside my script listed below!

Here's my script, any and all help is appreciated!

name="Humanoid"

robo=script.Parent:clone()

while true do
	wait(5)
	if script.Parent.Humanoid.Health<1 then
		robot=robo:clone()
		robot.Parent=script.Parent.Parent
		robot:makeJoints()
		script.Parent:remove()
	end
end