Attempted to index global field "Create" a nil value GMOD

I am trying to use the gods little finger swep on a darkrp server

what’s wrong with this?


function SWEP:PrimaryAttack ( )

         self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
	 self.Owner:SetAnimation ( PLAYER_ATTACK1 )
	 self.Weapon:SetNextPrimaryFire ( CurTime ( ) + 1.3 )
	 local thetrace = self.Owner:GetEyeTrace ( )

         local effectdata = EffectData ( )
         effectdata:SetOrigin ( thetrace.HitPos )
         effectdata:SetScale ( 5 )
         util.Effect( "WaterSurfaceExplosion", effectdata )
		 

	 local damage = ents.Create ( "point_hurt" )
	 damage:SetKeyValue ( "DamageRadius", 150 )
	 damage:SetKeyValue ( "Damage" , 100000 )
	 damage:SetKeyValue ( "DamageDelay", 0 )
	 damage:SetKeyValue ( "DamageType" ,"67108864" )
	 damage:SetPos ( thetrace.HitPos )
	 damage:Fire ( "TurnOn" , "", 0 )
	 damage:Fire ( "TurnOff" , "", 0.5 )
	 damage:Fire ( "kill","", 0.5 )


end

The error I get is



[ERROR] addons/owner gun/lua/weapons/gods_little_finger_v2/shared.lua:60: attempt to call field 'Create' (a nil value)
  1. unknown - addons/owner gun/lua/weapons/gods_little_finger_v2/shared.lua:60


[ERROR] addons/owner gun/lua/weapons/gods_little_finger_v2/shared.lua:60: attempt to call field 'Create' (a nil value)
  1. unknown - addons/owner gun/lua/weapons/gods_little_finger_v2/shared.lua:60



That code is shared but ents.Create doesn’t exist clientside

So, add “if ( SERVER ) then” checks where needed.

Yep that worked thanks!