DisableControlAction not working

Basically I want to stop the user using the E button when Robbing. This doesn’t work and I dont understand why. When printing Robbing it is printing true but the CONTROL isn’t being disabled.

RegisterNetEvent("QBCore:Client:OnPlayerLoaded", function()

while true do
        if Robbing == true then
            DisableControlAction(0, 38, true)
            print(Robbing)
            Wait(0)
        end
        Wait(0)
    end

end)

Hey,

I would try with removing one Wait(0), better to remove the one in nest, below disable.
Also try to change 38 to 46 in DisableControlAction.

It would look like this:

while true do
        if Robbing == true then
            DisableControlAction(0, 46, true) -- normally I'd also change 0 to 1, but tbh Idk what's the difference
            print(Robbing) -- leave if you want.
        end
        Wait(0)
end

Still the same unforunatley

How do you check if control is disabled?

Pressing the control and seeing a menu is allowed to be used with e. Basically im trying to stop people robbing the atm. pressing e and openning the atm menu. The script checks if button pressed so if i disable the control it wont be able to check right?

Well it’s not that simple. “E” key may be detected in many ways (numbers, you can check them in docs - game references), when you disable one way (e.g. number 46) button can still be used in other way (e.g. number 38), it depends on which script uses which number. So you either have to block every “E” number here (38, 46, 51, 54 etc.) or change every “E” number in every script for only the same number and then block only this number

The code is the script is using if IsControlJustReleased(0, 38) then and I am blockng that one and it doesnt work so Im unsure why it isnt working

I would remove print from the loop, maybe that’s the cause

It works now it was because it was input 0 not 1