attempt to index global 'ply' (a nil value)

I’m working on converting some parts of a gamemode to ULX and Im stuck on a simple error.
Here’s what I have for it:


AddGear("[O] Puke", "Left click to puke everywhere.", false,
	function ( Player, Trace )
				if not ply:IsUserGroup("owner") then
				Notify(Player, 0, 5, "Nope.");
				return false;
			end
			local self = Player:GetActiveWeapon();
			
			if !IsValid( self ) then return end 

			Player:ViewPunch( Angle( -5, 0, 0 ) )
	
			local edata = EffectData()
			edata:SetStart( Player:GetPos() )
			edata:SetOrigin( Player:EyePos() )
			edata:SetEntity( Player )

			util.Effect( "puke", edata, true, true )
			
	end
);

ply is never defined, change “if not ply:IsUserGroup(“owner”)” to “if not Player:IsUserGroup(“owner”)”



AddGear("[O] Puke", "Left click to puke everywhere.", false,
	function ( Player, Trace )
				if not LocalPlayer():IsUserGroup("owner") then
				Notify(Player, 0, 5, "Nope.");
				return false;
			end
			local self = Player:GetActiveWeapon();
			
			if !IsValid( self ) then return end 

			Player:ViewPunch( Angle( -5, 0, 0 ) )
	
			local edata = EffectData()
			edata:SetStart( Player:GetPos() )
			edata:SetOrigin( Player:EyePos() )
			edata:SetEntity( Player )

			util.Effect( "puke", edata, true, true )
			
	end
);