Script requires restart to function

Hello there. I am having an issue with a script and its not making much sense to me.
I have a script that disables the melee attack when holding a weapon. The script works when restarted on the fly, but if the script is running on the server, and I join after the fact, it wont work and I am able to press R to melee with my gun out again.

Here is the code, any help would be appreciated.

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
		local ped = PlayerPedId()
            	if IsPedArmed(ped, 6) then
	    	DisableControlAction(1, 140, true)
            	DisableControlAction(1, 141, true)
            	DisableControlAction(1, 142, true)
        end
    end
end)
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.