I'm working on a fivem volley ball script 

this is my client.lua
local object_netID = nil
local objectModel = "prop_beach_volball01"
local forwardForceIntensity = 10.0
local upwardForceIntensity = 5.0

local function loadModel(model)
    print("loading")
    local modelHash = GetHashKey(model)
    RequestModel(modelHash)

    while not HasModelLoaded(modelHash) do
        Citizen.Wait(100)
    end
    print('done')
    return modelHash
end

local function spawn_the_ball()
    local player = PlayerPedId()
    local position = GetEntityCoords(PlayerPedId())
    local modelHash = loadModel(objectModel)
    print("createdobject")
    createdObject = CreateObjectNoOffset(modelHash, position.x, position.y, position.z + 1, true, false, true) -- Use CreateObjectNoOffset and set isNetwork and netMissionEntity to true
    ActivatePhysics(createdObject)
    print("waiting")
    Citizen.Wait(1000)
    local playerRotation = GetEntityRotation(PlayerPedId(), 2)
    local forwardVector = GetEntityForwardVector(PlayerPedId())
    local forceVector = vector3(
        forwardVector.x * forwardForceIntensity,
        forwardVector.y * forwardForceIntensity,
        upwardForceIntensity
    )
    ApplyForceToEntity(createdObject, 1, forceVector.x, forceVector.y, forceVector.z, 0.0, 0.0, 0.0, 0, false, true, true, false, true)
    -- Get the object’s network ID
    local object_netID = ObjToNet(createdObject)
    -- Add this line after setting object_netID
    TriggerServerEvent("VB:setObjectNetworkID", object_netID)
end

RegisterCommand("testing", function()
    spawn_the_ball()
end)

local isInGame = true

local function isPlayerNearObject(object, distanceThreshold)
    local playerCoords = GetEntityCoords(PlayerPedId())
    local objCoords = GetEntityCoords(object)
    local distance = #(playerCoords - objCoords)
    return distance <= distanceThreshold
end

Citizen.CreateThread(function()
    while isInGame do
        Citizen.Wait(0)

        if object_netID then
            local createdObject = NetworkGetEntityFromNetworkId(object_netID)

            if isPlayerNearObject(createdObject, 3.0) and IsControlJustReleased(0, 38) then -- 38 is the key code for "E"
                print('E pressed')
                if not NetworkHasControlOfEntity(entity) then
                    print('has no control')
                    NetworkRequestControlOfEntity(entity)
                    while (not NetworkHasControlOfEntity(entity)) do
                        Citizen.Wait(0)
                    end
                end
                print('has control')
                local playerRotation = GetEntityRotation(PlayerPedId(), 2)
                local forwardVector = GetEntityForwardVector(PlayerPedId())
                local forceVector = vector3(
                    forwardVector.x * forwardForceIntensity,
                    forwardVector.y * forwardForceIntensity,
                    upwardForceIntensity
                )
                ApplyForceToEntity(createdObject, 1, forceVector.x, forceVector.y, forceVector.z, 0.0, 0.0, 0.0, 0, false, true, true, false, true)
            end
        end
    end
end)


RegisterNetEvent("VB:updateObjectNetworkID")
AddEventHandler("VB:updateObjectNetworkID", function(netID)
    object_netID = netID
end)

Citizen.CreateThread(function()
    TriggerServerEvent("VB:requestObjectNetworkID")
end)



server.lua

local QBCore = exports['qb-core']:GetCoreObject()
local object_netID = nil



RegisterServerEvent("VB:setObjectNetworkID")
AddEventHandler("VB:setObjectNetworkID", function(netID)
    object_netID = netID
    TriggerClientEvent("VB:updateObjectNetworkID", -1, netID)
end)

RegisterServerEvent("VB:requestObjectNetworkID")
AddEventHandler("VB:requestObjectNetworkID", function()
    local src = source
    if object_netID then
        TriggerClientEvent("VB:updateObjectNetworkID", src, object_netID)
    end
end)


for some reason the NetworkHasControlOfEntity and NetworkRequestControlOfEntity no work