Bad argument to 'GetBonePosition'

Hello,
I m having this error :

[ERROR] addons/fas 2.0 alpha sweps/lua/weapons/fas2_base/cl_model.lua:621: bad argument #2 to ‘GetBonePosition’ (number expected, got no value)

  1. GetBonePosition - [C]:-1
  2. unknown - addons/fas 2.0 alpha sweps/lua/weapons/fas2_base/cl_model.lua:621

This part:

pos, ang = GetBonePosition(self.Owner, self.Owner:LookupBone(“ValveBiped.Bip01_R_Hand”))

If i remove it there is no more error but then can’t see weps in hand.
How to fix that ?

P.S Another error am having problems to fix :

[ERROR] lua/autorun/photon/cl_emv_meta.lua:263: attempt to call method ‘ReconnectLights’ (a nil value)

  1. RenderEL - addons/photon lighting engine [beta]/lua/autorun/photon/cl_emv_meta.lua:263
  2. fn - addons/photon lighting engine [beta]/lua/autorun/photon/cl_emv_init.lua:15
    3. unknown - addons/ulib/lua/ulib/shared/hook.lua:184

This part :
if not RenderTable then return end

	self:ReconnectLights()
	local disconnect = self:GetELOverride()
	if disconnect then
		for k,v in pairs(disconnect) do
			self:DisconnectLight( v )
		end
	end

Wasn’t errors before gmod update…

the bone is in my pants :wink:

Your post is completely useless, he needs help, and he is in the right section, so don’t tell him that, otherwise you seams to not be an Adult…

@Grizly :
For your first problem, you made a mistake with the function.
Here is your corrected code :
Replace self.Owner with LocalPlayer() if you’re client side


local pos, ang = self.Owner:GetBonePosition(self.Owner:LookupBone("ValveBiped.Bip01_R_Hand"))

For your second problem now :
This


 [ERROR] lua/autorun/photon/cl_emv_meta.lua:263: attempt to call method 'ReconnectLights' (a nil value) 

means that your function called ReconnectLights is not existing or you’re calling it wrongly. To correct that I’ll need more code from you, otherwise it’s a bit hard to tell where’s the problem here… It’s forcely a problem with the way you’re calling the ReconnectLights function or the function which does not exists.

Thank you for the first one !
But am sorry i fell like noob… it should look like this ? :


 local pos, ang = LocalPlayer():GetBonePosition(LocalPlayer():LookupBone("ValveBiped.Bip01_R_Hand")) 

And about second one … Seems like am not having that error again, because i changed one emergency vehicle and photon is working good now.

P.S Sorry about my english spelling.

it’s actually causing that error because
self.Owner:LookupBone(“ValveBiped.Bip01_R_Hand”)
is returning nil - meaning there is no bone by that name on the model the person is using.

BUMP

Still having issue with that GetBonePosition …
Its kinda randomly for users giving error.
FOre example when using Spider SWEP

MeepDarknessM gave you an answer already.

I see but how do i fix it ?

Use a player model that has that bone, it’s pretty obvious.

Or add safeguards for models that do not have that bone.

You really shouldn’t do this, but if you just want a quick fix, try this:


local bone = self.Owner:LookupBone("ValveBiped.Bip01_R_Hand")
pos, ang = GetBonePosition(self.Owner, bone and bone or 0)

You don’t need the ‘and’ if the first and second arguments to the ternary are the same.

bone or 0 will work the same.