Hey i have this code:
local Forward = self.Owner:EyeAngles():Forward()
local ent = ents.Create( "prop_physics" ) if ( ValidEntity( ent ) ) then local phys = ent:GetPhysicsObject() ent:SetModel("models/props_c17/oildrum001.mdl")//"models/Weapons/w_bugbait.mdl") ent:SetPos( self.Owner:GetShootPos() + Forward * 32 ) ent:SetAngles( self.Owner:EyeAngles() ) ent:Spawn() phys:Wake() -- line 64 phys:SetVelocity( Forward * 500)
but iam getting this error:
weapons/weapon_grenadelauncher/shared.lua:64: Tried to use invalid object (type IPhysicsObject) (Object was NULL or not of the right type)
any idea’s? I origionally thought i was because i was using bugbait as the model and that may not have a physics object but after changing it to a barrel (seen above) i know it must be the code, but i cannot see what is wrong with it. Any idea’s?