Autotaunting for prophunt

So over the last few weeks I’ve been meaning to get around to creating a autotaunt function for my prophunt server, but when i looked through google to see how to use timers etc i just got confused. I came across a timed function and decided to try it with that…

Heres the script i added in my init.lua file.



local function AutoTaunt(pl)
	if GAMEMODE:InRound() && pl:Alive() && (pl:Team() == TEAM_HUNTERS || pl:Team() == TEAM_PROPS) && pl.last_taunt_time + TAUNT_DELAY <= CurTime() && #PROP_TAUNTS > 1 && #HUNTER_TAUNTS > 1 then
		repeat
			if pl:Team() == TEAM_HUNTERS then
				rand_taunt = table.Random(HUNTER_TAUNTS)
			else
				rand_taunt = table.Random(PROP_TAUNTS)
			end
		until rand_taunt != pl.last_taunt
		
		pl.last_taunt_time = CurTime()
		pl.last_taunt = rand_taunt
		
		pl:EmitSound(rand_taunt, 100)
	end	
end
 
timer.Simple( 30, AutoTaunt, pl )

Most of the function i copied from the taunt function already in prophunt and it works neither the less, but what I’m wanting to know is, will what i have actually work or will it screw up?