Add vehicle to garage

local newPlate = GeneratePlate()
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
vehicleProps.plate = newPlate
SetVehicleNumberPlateText(vehicle, newPlate)
TriggerServerEvent(‘esx_giveownedcar:setVehicle’, vehicleProps, playerID, vehicleType)

this doesnt work

1 Like

Hey :slightly_smiling_face: !
Would need to see more of the script and have a little more context to be able to help you.

RegisterNetEvent(‘lootbox:RewardVehicle’)
AddEventHandler(‘lootbox:RewardVehicle’, function(model)
– local playerPed = GetPlayerPed(-1)
– local coords = GetEntityCoords(playerPed)
– local Px, Py, Pz = table.unpack(coords)

    ESX.Game.SpawnVehicle(model, { x = 0, y = 0, z = 0 }, 180, function (vehicle)
        -- TaskWarpPedIntoVehicle(playerPed, vehicle, -1)

        local newPlate     = GeneratePlate()
        local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
        vehicleProps.plate = newPlate
        SetVehicleNumberPlateText(vehicle, newPlate)
        TriggerServerEvent('esx_vehicleshop:setVehicleOwned', vehicleProps)
                                       
    end)

end)

It could be something to do with the vehicle not saving inside the database. Check if that code exists or is correct

you were right the event didnt exist so now i replaced it with esx_vehicleshop:setVehicleOwnedPlayerId but it still dont work

I’m not too sure, as I’m not really familiar with esx

idk too no error or something