What is the problem in this Script

_menuPool = NativeUI.CreatePool()
mainMenu = NativeUI.CreateMenu("Aktionen", "~b~NeoxGaming Menu")
_menuPool:Add(mainMenu)

-- Used in "SubMenu"
ESX = nil
bool = false
local xPlayer = ESX.GetPlayerFromId(source)
local job = xPlayer.job.name
local PlayerData = {}

Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
		Citizen.Wait(0)
	end
end)

-- used in "FourthItem"
seats = {-1,0,1,2}
function FirstItem(menu) 
   local submenu = _menuPool:AddSubMenu(menu, "~b~Auto Menu") 
   local seat = NativeUI.CreateSliderItem("Sitzplatz ändern", seats, 1)
    submenu.OnSliderChange = function(sender, item, index)
        if item == seat then
            vehSeat = item:IndexToItem(index)
            local pedsCar = GetVehiclePedIsIn(GetPlayerPed(-1),false)
            SetPedIntoVehicle(PlayerPedId(), pedsCar, vehSeat)
        end
    end

    local checkbox = NativeUI.CreateCheckboxItem("Unterbodenbeleuchtung", bool, "An / Aus")
    menu.OnCheckboxChange = function (sender, item, checked_)
       -- check if what changed is from this menu
       if item == checkbox then
         bool = checked_
       end
    end


    submenu:AddItem(seat)
    if job == 'fib' then
    submenu:AddItem(checkbox)
    end
end

FirstItem(mainMenu)
_menuPool:RefreshIndex()

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        _menuPool:ProcessMenus()
        --[[ The "e" button will activate the menu ]]
        if IsControlJustPressed(1, 47) then
            mainMenu:Visible(not mainMenu:Visible())
        end
    end
end)




--[[ COPY BELOW ]]

function notify(text)
    SetNotificationTextEntry("STRING")
    AddTextComponentString(text)
    DrawNotification(true, true)
end

function giveWeapon(hash)
    GiveWeaponToPed(GetPlayerPed(-1), GetHashKey(hash), 999, false, false)
end

function spawnCar(car)
    local car = GetHashKey(car)

    RequestModel(car)
    while not HasModelLoaded(car) do
        RequestModel(car)
        Citizen.Wait(50)
    end

    local x, y, z = table.unpack(GetEntityCoords(PlayerPedId(), false))
    local vehicle = CreateVehicle(car, x + 2, y + 2, z + 1, GetEntityHeading(PlayerPedId()), true, false)
    SetPedIntoVehicle(PlayerPedId(), vehicle, -1)
    
    SetEntityAsNoLongerNeeded(vehicle)
    SetModelAsNoLongerNeeded(vehicleName)
    
    --[[ SetEntityAsMissionEntity(vehicle, true, true) ]]
end
1 Like

I… Don’t know, you tell me! What happens when it’s run? In what way does it not work? What have you tried so far?

If it start it come no error but when i press g then didnt open the menu and i meen it it this:

and this: