Is there a way to check something and if it’s false, then completely ignore the line of code and continue with the scripts below it, and if it’s true then run that line of code along with the ones below it.
How do I check if a statement is true, then continue the scripts?
Yes most certainly Like almost every programming language, lua has a system for conditionals. In lua you can check for a condition and run the code inside the scope of the block.
(hey if this helped you should click "accept answer")
if (condition1) then print"a" --// runs if condition1 is true elseif (condition2) then print"b" --// runs if condition2 is true but not if condition1 was true else print"c" --// runs if no other conditions worked end print"d" --// runs eitherway since its outside the scope of the if statement
Is there a way to check something and if it’s false, then completely ignore the line of code and continue with the scripts below it, and if it’s true then run that line of code along with the ones below it.
Yes there certainly is just put your code in a if statement or a function that is called if the statement is true.
local function wasTrue() --// some code end local function wasFalse() --// some other code end if (condition) then wasTrue() else wasFalse() end