[HELP] NetworkCreateSynchronisedScene

Hi

I cant get my head around NetworkCreateSynchronisedScene

Im trying to do the synced animation of the small safe from the Casino Heist

Now I do this in a custom mlo (mazebank mlo)

I always get teleported at some wrong offset and not infront of the found safe (which it does find)

Can someone help me out?
Even tried chatgpt :rofl:

Used the synchronised tool from D7mad to get the animation

function MiniSafeAnim(heading)
    local animDict = "anim_heist@arcade_property@arcade_safe_open@male@"
    if GetGender() == 1 then
        animDict = "anim_heist@arcade_property@arcade_safe_open@female@"
    end
    
    RequestAnimDict(animDict)
    while not HasAnimDictLoaded(animDict) and timeout > 0 do
        Wait(50)
    end

    local ped = PlayerPedId()
    local targetPosition = GetEntityCoords(ped)
    local targetRotation = GetEntityRotation(ped)

    local door = GetClosestObjectOfType(targetPosition.x, targetPosition.y, targetPosition.z, 5.0, -1992154984, false, false, false)
    if not DoesEntityExist(door) then
        print("Safe door not found!")
        return
    end

    NetworkRequestControlOfEntity(door)
    SetCurrentPedWeapon(ped, GetHashKey("WEAPON_UNARMED"), true)
    SetEntityAsMissionEntity(door, true, true)
    FreezeEntityPosition(ped, true)

    local netScene = NetworkCreateSynchronisedScene(
        targetPosition.x, targetPosition.y, targetPosition.z, 
        targetRotation.x, targetRotation.y, targetRotation.z, 
        2, false, false, -1, 0, 1.0
    )
    NetworkAddPedToSynchronisedScene(ped, netScene, animDict, "safe_open", 1.5, -4.0, 1, 16, 1148846080, 0)
    NetworkAddEntityToSynchronisedScene(door, netScene, animDict, "safe_open_safedoor", 1.0, 1.0, 1)

    NetworkStartSynchronisedScene(netScene)
    Wait(GetAnimDuration(animDict, "safe_open") * 1000)

    local netScene2 = NetworkCreateSynchronisedScene(
        targetPosition.x, targetPosition.y, targetPosition.z, 
        targetRotation.x, targetRotation.y, targetRotation.z, 
        2, false, false, -1, 0, 1.0
    )
    NetworkAddPedToSynchronisedScene(ped, netScene2, animDict, "safe_close", 1.5, -4.0, 1, 16, 1148846080, 0)
    NetworkAddEntityToSynchronisedScene(door, netScene2, animDict, "safe_close_safedoor", 1.0, 1.0, 1)

    NetworkStartSynchronisedScene(netScene2)
    Wait(GetAnimDuration(animDict, "safe_close") * 1000)

    FreezeEntityPosition(ped, false)
end

Have you managed to fix it?

I managed to fix it, you will have to add a offset system