[HELP] Attaching Object to Player

Hi, Im working on an action menu atm but, I’m having some problem with

AttachEntityToEntity("prop_riot_shield", GetPlayerPed(PlayerId()), GetPedBoneIndex(GetPlayerPed(PlayerId()), 61163), 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0, 1, 0, 1)

It doesnt seem to do anything. I tried to debug it with print('Works?') Nothing prints.
I trigger it through this but I dont think it works.
elseif WarMenu.Button('Shield') then TriggerEvent("shield")
Any help is appreciated. Thanks!

I use this:

    local shield = CreateObject(GetHashKey(prop), pedPos.x, pedPos.y, pedPos.z, 1, 1, 1)
    shieldEntity = shield
    AttachEntityToEntity(shieldEntity, ped, GetEntityBoneIndexByName(ped, "IK_L_Hand"), 0.0, -0.05, -0.10, -30.0, 180.0, 40.0, 0, 0, 1, 0, 0, 1)

And of course define pedPos :slight_smile:

Wait, It spawns the shield like 20 ft infront of you and Is not attached?

Hmm, you sure you defined pedPos properly? I mean… it works for me xD

1 Like

I do however, use it with an anim, that might be the trick.

Can I see your whole code with the Attached Prop?

Try look at this, I use some snippets from Xander’s code here: