Trying to create clientside scripted bonemerge

I’m trying to make a nice little client sided scripted version of EF_BONEMERGE, the benefit of it also being scripted and easy to modify. However, I just can’t get this to work.
The first time I run this I get nothing (although the code does run, I’ve hooked up a print to it before) but if I run it a second time gmod crashes.
Can someone explain/correct my mistakes please?

FakeModel=ClientsideModel(“models/Police.mdl”, RENDERGROUP_OPAQUE)

function FakeClientBones()

for i=1, 128 do
local PlrBonePos,PlrBoneAng=PlayerTarget:GetBonePosition(PlayerTarget:LookupBone(i))
local MdlBonePos,MdlBoneAng=FakeModel:GetBonePosition(FakeModel:LookupBone(i))




Noone will see this model if you are doing a clientside model and parenting it LocalPlayer.

Is this what you are attempting to do?

Yes, that is it. Later on I’ll do stuff like network it with the server and use bone matrices to create a sort of “ingame headhack”.

You can use AddEffects(EF_BONEMERGE)

Like I said, I’m trying to create a clientside scripted version I can easily modify for my purposes.

I don’t suppose I could get a reply please? This conundrum is really peculiar.

forgive me if I speak out of ignorance, because I haven’t work with BuildBonePositions much, but doesn’t that function require a couple of variables to be passed in?

ENT:BuildBonePositions( Integer NumBones, Integer NumPhysBones )

Hm, never noticed it.
However, something I did find on the wiki:

I tried calling ClientSideModel in the BuildBonePositions code, but it wasn’t having any of it.