PhysObj:GetMass()...

Firstly I apologise if my mistake is a common/stupid mistake, I have recently decided to learn how to make simple scripted weapons on garry’s mod and I’m still learning, My code runs when the function SWEP:SecondaryAttack is executed.


    local pr = Entity( 1 ):GetEyeTrace().Entity
	      local pl = player.GetByID( 1 )
	      local en = Entity( 1 ):GetEyeTrace().Entity
		  local ms = pr:GetMass()
          en:SetVelocity( pl:GetAimVector() * 2 * ms + Vector(0,0,3))
	      pr:GetPhysicsObject():ApplyForceCenter(pl:GetAimVector() * 2000  + Vector(0,0,6000)) 

I’d like to know why the GetMass() is invalid.


[ERROR] addons/deception/lua/weapons/theforce/init.lua:26: attempt to call method 'GetMass' (a nil value)
  1. forcesecondary - addons/thetruedragonace/lua/weapons/theforce/init.lua:26
   2. unknown - addons/thetruedragonace/lua/weapons/theforce/shared.lua:56



I do understand that the error means the GetMass isn’t returning a value but what I’d like to know is how I could do anything differently to fix it.
I also apologize if I sound like I’m asking to be spoonfed, As I’m learning I am trying my best not to use facepunch much but I’m completely stuck.
Any reply helps out :3
Thanks in advance



pr:GetPhysicsObject():GetMass()


I had just realized I used the GetMass in the entity velocity change, Although I ran it again with the MS effecting the prop and nothing changed.