Physics gun doesn't pickup entities properly

Hey :slight_smile:
I just need help with creating an entity. I am an experienced coder, but I never fixed that annoying thing that happens when I create an entity.
Lets say that I want to pick it up with my physgun. It will be moved, however - physgun beam will not move, like my entity is still in its first place
Thanks :slight_smile:

This doesn’t happen with normal entities, maybe you’re creating something on the entity not in the right way. Thing is, we can’t really help you if you give us no code.

I work with a lot of entities, and I thought I never found out what the problem is. Turns out, you have set up the physics (setModel excluded) ON THE SERVER, if you run it clientside, this will happen.
So just make it
[lua]
if(SERVER) then … end
[/lua]

[lua]
function ENT:Initialize()
local ItemReference = item[self.BaseItem]
local MaterialReference = ItemReference.material
local ColorReference = ItemReference.color
local MatReference = ItemReference.actual_material

self:SetModel( ItemReference.model )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetCollisionGroup( COLLISION_GROUP_DEBRIS )
self:SetSolid( SOLID_VPHYSICS )
self:PhysWake()

if self:CompareToNil( MaterialReference ) then
	self:SetMaterial( MaterialReference )
end

if self:CompareToNil( ColorReference ) then
	self:SetColor( ColorReference )
end

if self:CompareToNil( MatReference ) then
	if !IsValid( self:GetPhysicsObject() ) then
		self:GetPhysicsObject():SetMaterial( MatReference )
	end
end

end
[/lua]

Well thats shared ;/
EDIT: THANK YOU :smiley: Yea I made it serverside only