SetEntityVisible and SetEntityInvincible on players doesn't work

I quote an example

function PutInBodybag()

    local playerPed = PlayerPedId()
    local playerCoords = GetEntityCoords(playerPed)
    
    deadCheck = IsEntityDead(playerPed)

    if deadCheck and not attached then
        SetEntityVisible(playerPed, false, false)
        
        RequestModel(Config.bag_model)

        while not HasModelLoaded(Config.bag_model) do
            Citizen.Wait(1)
        end

        bodyBag = CreateObject(Config.bag_hash, playerCoords.x, playerCoords.y, playerCoords.z, true, true, true)

        AttachEntityToEntity(bodyBag, playerPed, 0, -0.2, 0.75, -0.2, 0.0, 0.0, 0.0, false, false, false, false, 20, false)
        attached = true

    end
end

this is the code. Is someone know why are thiese not working? Essentialmode sided server could affect it? I should transform the server to es_extended? :pleading_face:

SetEntityVisible(playerPed, false, 0)
so this last false needs to be a zero

Is this code snippet from the client or the server?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.