i write a script that has if false then and when i tested the game it didn’t show up in developer console and didn’t print what i need to print and the same thing with printing the statement is false. there is a picture of the script
If you do “if false then” your basicly checking wondering if false is true. and false is not true so it wont print. Idk what your trying to do but you need to check the false with another value like if false == false then or if game.workspace.yourvalue.Value then
local FirstVar = false
if FirstVar == false then
Print("FirstVar is false! (First example)")
end
-- And the same for true
if FirstVar == true then
Print("FirstVar is true! (First example)")
end
Second example:
local SecondVar = true
if not SecondVar then -- "if not [VarName] then" Essentially will check for false when the var is a bool.
Print("SecondVar is false! (Second example)")
end
-- And the same for true
if SecondVar then -- "if [VarName] then" Essentially will check for true when the var is a bool.
Print("SecondVar is true! (Second example)")
end
If you need more help refer to the official documentation here.
The philosophy behind if statements is to check whether a condition is true before executing a block of code: this condition can be a simple value or a comparison.
Your code is not running because the value false is, well, by definition, false. An if statement with the condition false will not run the associated code block
Therefore, in this specific case where the variable itself is set to false , you need to explicitly check if the value is equal tofalse:
local value = false
if value == false then -- checks: "is this false?" yes, it is
-- code
end
Alternatively, you could use the not operator to check if the value is not true (which is the same as checking if it’s false)
local value = false
if not value then -- checks: "is this not true?" yes, it is not true
-- the code here will also run
end
If is followed by a condition check, and if that condition is true, the code block executes.
---------------
local v = true
---------------
if v == true then
end
if v then
end
if true then
end
---------------
local v = false
---------------
if v == false then
end
if not v then
end
if v ~= true then
end
Instead of saying if false then, which ur basically checking if “false” is equal to true, do if false == false, which means basically what it’s saying. If false is false, then it’s true.