Hello. I know that this is probably really simple to fix, hence why i couldn’t find anything about it on the internet. But the problem is that the script thinks that i mean
local variable = true
if not variable == true then
if not variable. But i want it to mean if not variable == true then do the thing. Thanks!1!
Just remove the == true and it should work, alternatively you could also replace the == true with == false or ~= true where the swiggly line followed by equal sign means not equal to.
Example:
local variable = true
if not variable then
end
local variable = true
if variable == false then
end
local variable = true
if variable ~= true then
end
Quick addition to Kat_ie’s post: One reason why people use if not variable in favor of if variable == false is because the latter ( if variable == false) doesn’t work for nil values. Sometimes, Roblox functions return nil instead of false when it can complete whatever task you ask it to do. To check for this, people either say if not variable or if variable == nil. Because us devs are lazyoptimal creatures, we generally default to if not variable because of its versatility to work for both boolean and nil values.