Ents.create crashing server.

Hi. I’m having a little problem here. I was wondering if anyone is able to assist me in this. i’ve been trying to find a fix for it for just a bit now, and I couldn’t find a way to get this to work.
Any type of help would be well appreciated. It crashes my server on startup. But it works fine when I add “Createnpc(blah,blah,blah)” while the server’s up.

function createnpc(entity,position,health)

	local createnpc = ents.Create( entity )
	if ( !IsValid( createnpc ) ) then return end // Check whether we successfully made an entity, if not - bail
	createnpc:SetPos( position )


createnpc("npc_antlion",Vector(-1258.724121, -1560.611328, -139.968750),100)

Try spawning entities after Initialize is called.

Totally forgot to reply to this. But I hooked initialize and created a timer inside with 10 seconds and it worked fine. Thanks. using init didn’t work alone