Rotating a lua spawned turret upright crashes client

Here’s the problem,

I used this code:
[lua]local turret = ents.Create(“npc_turret_floor”)
turret:SetPos(Vector(0,0,0))
turret:Spawn()

turret:AddEntityRelationship(player.GetByID(1), 4, 99 )
[/lua]

To spawn a turret, now when I rotate it upright my client crashes.

EDIT: Video for proof:

I have no idea what I did wrong…

Thanks in advance,
TheJjokerR

-snip-

Happens to me too. I just don’t rotate it upside down.

Does anyone have an actual idea on how to fix this? Could it be something with the physics? Or is it the relations you see in my code?

Thanks…

It has nothing to do with your code. What’s happening is the turret is re-enabling itself, or at least trying to. This seems to cause an exception which crashes the game. This is a bug for Garry to fix and should be submitted to him.

I see… Would it be an idea to completely remake the turret?(I’ve tried it before, but couldn’t animate a turret…)