if a bool variable is using a “not” statement for example
local Opened = false
if Opened == false then
end
-- Instead of that ^ i want to use the "not" statement because it looks cleaner but i'm still confused.
if not opened then -- I want this to be "If opened == false" but Would it be "If opened == true" because it's a not statement?
Do note that booleans have different behaviors compared to other variables.
local str: string = "what"
if str then -- prints because string exists (acts like if str ~= nil then)
warn("what")
else
warn("what2")
end
vs
local bool: boolean = false
if bool then
warn("what")
else
warn("what2") -- prints because bool == false
end
if bool ~= nil then -- for bools if you want to check if it's nil or not, you'd have to do this
warn("what3")
end
It’s basically typechecking, it’s completely optional and won’t affect anything on your script except tell what ‘type’ a variable is (which allows the autocomplete to display functions and properties specific to that type).