Change variable based on value (SOLVED)

#1

Is there a better way I can change a variable based on the given value for example:

local active = 0

function level_data(self)
    if active == 0 then
        active = false
    else
        true
    end
end

I have a few variables that I would like to change in this way.

0 Likes

#2

This should work:

active = not (active == 0)
5 Likes