Lua particles help

So I’ve been trying to figure out how to make particles for things like when you open something just make confetti come out or something. I spent hours try to understand it from these threads:

and also used the wiki’s to find out how to make it. I used tf2 to make a particle using the -tools startup command. The problem is I don’t understand how to use them since they’re kind of not really documented, Could anyone show me how to make effects like those? The closest thing I got was making this:


local function head()	
local ply = LocalPlayer()
local HeadIndex = ply:LookupBone( "ValveBiped.Bip01_Head1" )  
local HeadPos, HeadAng = ply:GetBonePosition( HeadIndex )
timer.Create( "UniqueName1", .2, 0, head )

the timer is to update the position else it will stay in one position, the whole code is in one file and opening it using lua_openscript_cl, and for some reason sometimes the particle won’t load and will spawn big red X’s as the particle instead. I need information on how to properly use particles.