Trying to make a script that gives players popcorn upon spawning in

function OnPlayerSpawn( ply )
ply:Give( "weapon_popcorn" )

I’m a complete noob when it comes to scripting I have zero knowledge of it. I just want to do this one simple thing. Can somebody help me out?

hook.Add("PlayerSpawn", "givemepopcorn", function(ply)

Put somewhere serverside (lua/autorun/server/sv_popcorner.lua)

you are a godsend thank you so much. You are indeed special.

It should actually be given in PlayerLoadout ( hook called by PlayerSpawn, specifically for weapons / armor, etc ).