• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community

attempt to call a nil value (1 Viewer)

Batata

Newcomer
Joined
Jun 10, 2021
Messages
1
Reaction score
0
I'm trying to make a command with the mouse but it's giving this error could someone help me??

script11.png
Lua:
EnablePrimaryMouseButtonEvents(true);

local Autotag = 1

function Autotag(PressMouseButton)
    if (x=="no") then
        if (seconds1<seconds2) then
            Sleep(1)
        else
            PressKey(Autotagmfer)     
            Sleep(math.random(AltPressSpeedMin,AltPressSpeedMax))
            ReleaseKey(Autotagmfer)
            Sleep(math.random(InBetweenSpeedMin,InBetweenSpeedMax))
            PressKey(Autotagmfer)
            Sleep(math.random(AltPressSpeedMin,AltPressSpeedMax))
            ReleaseKey(Autotagmfer)
            Sleep(2)
            seconds2 = seconds1 + AUTOTAGONLY
        end
    else
        PressKey(Autotagmfer)     
        Sleep(math.random(AltPressSpeedMin,AltPressSpeedMax))
        ReleaseKey(Autotagmfer)
        Sleep(math.random(InBetweenSpeedMin,InBetweenSpeedMax))
        PressKey(Autotagmfer)
        Sleep(math.random(AltPressSpeedMin,AltPressSpeedMax))
        ReleaseKey(Autotagmfer)
        Sleep(2)
        seconds2 = seconds1 + AUTOTAGONLY
    end
  
    function OnEvent(event, arg) 
        --HIGHRecoiltoggle on/off
        if IsKeyLockOn(REcoilHIGHTogggle) then
            HIGH_Recoil=true
        else
            HIGH_Recoil=false
        end

        if IsKeyLockOn(LockKey)    then         --This toggles Recoil on/off
            if IsMouseButtonPressed(RC)    then --Loop for ADS. Primes Norecoil, Autotag and rapidfire                                 
                repeat
                    if IsMouseButtonPressed(LC) then     --Norecoil
                        seconds=GetRunningTime()
                        seconds1= seconds/1000
                        Autotag()                 
                           NoRecoil()
                    elseif IsMouseButtonPressed(Rapidfirebutton) then        --Rapidfire
                        seconds=GetRunningTime()
                        seconds1= seconds/1000
                        Autotag()             
                        RapidFire() 
                    end
                until not IsMouseButtonPressed(RC)                --end of Priming loop
            end
        end
    end
end
 

Herly Quijano

Newcomer
Joined
Mar 19, 2021
Messages
77
Reaction score
10
Did you tried use xpcall? basically in the top of the body of your function write "xpcall(function() " and in the bottom write "end, print)" I think it would print where is the error.
 
Top