[HELP] Why does my code loop with true?

Hi, I’m using Izone and SafeZone, which I want to combine to make more precise and non-spherical secure zones.
In the video I show the loop that it does, since it sends true infinity of times.

Citizen.CreateThread(function()
    while true do
    Wait(100)
        TriggerEvent("izone:isPlayerInZone", "plaza", function(isIn)
            if isIn and not notifIn then
                NetworkSetFriendlyFireOption(false)
                ClearPlayerWantedLevel(PlayerId())
                TriggerEvent("pNotify:SendNotification",{
                    text = "<b style='color:#1E90FF'>Zona segura</b>",
                    type = "success",
                    timeout = (3000),
                    layout = "bottomcenter",
                    queue = "global"
                })
                notifIn = true
                notifOut = false
            elseif not isIn and not notifOut then
                NetworkSetFriendlyFireOption(true)
                TriggerEvent("pNotify:SendNotification",{
                    text = "<b style='color:#1E90FF'>Zona no segura</b>",
                    type = "error",
                    timeout = (3000),
                    layout = "bottomcenter",
                    queue = "global"
                })
                notifOut = true
                notifIn = false
            end
                    
            if isIn then
                DisableControlAction(2, 37, true) -- disable weapon wheel (Tab)
                DisablePlayerFiring(player,true) -- Disables firing all together if they somehow bypass inzone Mouse Disable
                DisableControlAction(0, 106, true) -- Disable in-game mouse controls
                    
                if IsDisabledControlJustPressed(2, 37) then --if Tab is pressed, send error message
                    SetCurrentPedWeapon(player,GetHashKey("WEAPON_UNARMED"),true) -- if tab is pressed it will set them to unarmed (this is to cover the vehicle glitch until I sort that all out)
                end
                    
                if IsDisabledControlJustPressed(0, 106) then --if LeftClick is pressed, send error message
                    SetCurrentPedWeapon(player,GetHashKey("WEAPON_UNARMED"),true) -- If they click it will set them to unarmed
                end
            end
        end)
    end
end)

Hi, where do you get “isIn” from?You can also add :

local notifOut = false
local  notifIn = false

at the top of your script if not already done.

It is in a while true do with only a second wait time… so every second it is checking to see if the player is in or not… and then does the right response.

Not sure if that was what you were asking or not.

SpikE

Here it’s the code if someone can help me.
PD: Sorry for me bad English