Need help with an Error.

Error


[ERROR] gamemodes/paintball/entities/weapons/paintball_smg/shared.lua:78: attempt to call field 'Create' (a nil value)
  1. unknown - gamemodes/paintball/entities/weapons/paintball_smg/shared.lua:78

Shared.lua for the Swep


if ( SERVER ) then
	AddCSLuaFile( "shared.lua" )
	SWEP.HoldType			= "pistol"
end

if ( CLIENT ) then
	SWEP.PrintName		= "PaintBall SMG"
	SWEP.Author		= "Goodguy68"
	SWEP.Contact		= "Goodguy68"
	SWEP.Purpose		= ""
	SWEP.Instructions	= 	"Shoot with primary fire."
	SWEP.CSMuzzleFlashes    = true
	SWEP.Slot		= 1
	SWEP.SlotPos		= 8
end
SWEP.data = {}
SWEP.data.newclip = false

SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

SWEP.ViewModel			= "models/weapons/v_rif_sg552.mdl"
SWEP.WorldModel			= "models/weapons/w_rif_sg552.mdl"
SWEP.ViewModelFlip		= true

SWEP.Drawammo = true
SWEP.DrawCrosshair = false

SWEP.Weight			= 5
SWEP.AutoSwitchTo		= false
SWEP.AutoSwitchFrom		= false

SWEP.Primary.Sound		= Sound( "marker/pbfire.wav" )
SWEP.Primary.Recoil		= 0.03
SWEP.Primary.Damage		= 1
SWEP.Primary.NumShots		= 1
SWEP.Primary.Cone		= 0.01
SWEP.Primary.ClipSize		= 50
SWEP.Primary.Delay		= 0.30
SWEP.Primary.DefaultClip	= 600
SWEP.Primary.Automatic		= true
SWEP.Primary.Ammo		= "ar2"

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Ammo		= "none"

function SWEP:Reload()
	self.Weapon:DefaultReload( ACT_VM_RELOAD );
end

function SWEP:SecondaryAttack()
	if not bZoomed then
	if (SERVER) then
		self.Weapon:GetOwner():SetFOV(45,0.35)
	end
	self.Weapon:EmitSound(Sound("weapons/zoom.wav"))
	bZoomed = true
	else
		bZoomed = false
		if (SERVER) then
			self.Owner:SetFOV( 0, 0.35 )
		end
		self.Weapon:EmitSound(Sound("weapons/zoom.wav"))
	end
end 

function SWEP:PrimaryAttack()
	if ( !self:CanPrimaryAttack() ) then return end

		self.Weapon:EmitSound(Sound( "marker/pbfire.wav" ))
		self.Weapon:SetNextPrimaryFire( CurTime() + 0.10 )
		self:ShootEffects()
		self:TakePrimaryAmmo( 1 )
		
		local ply = ents.Create("paint_ball")
		
		local shotpos = self.Owner:GetShootPos()
		shotpos = shotpos + self.Owner:GetForward() * 5
		shotpos = shotpos + self.Owner:GetRight() * 10
		shotpos = shotpos + self.Owner:GetUp() * -10.0
		util.Decal("splat1", shotpos, Pos2)
		
		local Pos2 = ply:SetAngles(self.Owner:EyeAngles())
		ply:SetPos(shotpos)
		ply:SetAngles(self.Owner:EyeAngles())
		ply:SetOwner(self.Owner)
		ply:Spawn()

	if SERVER then
		local phys = pb:GetPhysicsObject()
		phys:ApplyForceCenter(self.Owner:GetAimVector() * 30000 )
	end
end

function SWEP:ShootEffects()
	self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
	self.Owner:SetAnimation( PLAYER_ATTACK1 )
end

PS:Gun works on Singleplayer, Doesn’t work on Multiplayer though.

It’s trying to call ents.Create() from the client, but the function is only available server-side. Try adding that line and the related lines to the “if SERVER then” statement.