Hi there, just ran into a problem with a car plate change script I am making.
Issue
I keep getting this error
SCRIPT ERROR: (file name, line) attempt to call a nil value (field “GetPlayerPedId”)
And I really dont know how to fix it tho I have tried a couple of things.
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterCommand("platech", function(source, args)
Animation()
StopAnimTask(PlayerPedId(), "mini@repair", "fixing_a_player", 1.0)
local _source = source
local xPlayer = ESX.GetPlayerPedId(_source)
xPlayer.addInventoryItem(plate, 1)
exports['mythic_progbar']:Progress({
name = "unique_action_name",
duration = 10000,
label = 'Bytter skilt',
useWhileDead = true,
canCancel = true,
controlDisables = {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}
}, function(cancelled)
if not cancelled then
-- Do Something If Action Wasn't Cancelled
else
-- Do Something If Action Was Cancelled
end
end)
end)
So if anyone want to reach out and help me, I’ll be greatful. I hope its not a big change that has to be done
Regards from A man with issues