• Help with ent attachment.
    0 replies, posted
So i'm kind using a couple addons together to make a new swep. So I need a prop to be stuck to the players head when function SWEP:PrimaryAttack() and when the player dies the prop needs to be removed. This is what I got so far. function SWEP:Deploy( pos, ang ) if SERVER then        self.Weapon:SendWeaponAnim(ACT_VM_DRAW)     timer.Simple( 0.5, function()self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)end) if IsValid(self.ent) then return end  self:SetNoDraw(true) self.ent = ents.Create("prop_physics") self.ent:SetModel("models/vinrax/props/scp035/035_mask.mdl", RENDERGROUP_OPAQUE) local ply = self.Owner local backBone = ply:LookupBone("ValveBiped.Bip01_Head1") local bonePos, boneAng = ply:GetBonePosition( backBone ) boneAng:RotateAroundAxis(boneAng:Up(), 0) boneAng:RotateAroundAxis(boneAng:Right(), 0) boneAng:RotateAroundAxis(boneAng:Forward(), 0) self.ent:SetPos( bonePos + Vector(0,0,0) ) self.ent:SetAngles( boneAng ) self.ent:SetCollisionGroup( COLLISION_GROUP_WORLD ) self.ent:Spawn() self.ent:Activate() self.ent:SetParent(ply) end return true end You can see from the pictures the prop spawns and is attcahed to the player but its not attached to the head. Im not good with lua so any help would be greatly appreciated.
Sorry, you need to Log In to post a reply to this thread.