Have you read my blog post? https://scriptinghelpers.org/blog/two-scripting-tips-which-will-make-scripting-easier
I normally use those to script if-then blocks. What's really handy to note is that Lua handles everything as true except false and nil. You can use this!
function get(tab, provided)
local to_index = provided or 1
return tab[to_index]
end
Also, the syntax you use is incorrect. You should try to think of "or", "and" and "not" as functions.
I will rewrite those without using and/or/not:
function OR(arg1, arg2)
if arg1 == nil then
return arg2
elseif arg1 == false then
return arg2
end
return arg1
end
function AND(arg1, arg2) equivalent of arg1 and arg2
if arg1 == nil then
return arg1
elseif arg1 == false then
return arg1
end
return arg2
end
function NOT(arg1)
if arg1 == nil then
return true
elseif arg1 == false then
return true
end
return false
end
There are two differences with these functions though. These statements only evaluate when necessary. For example, torso = Player.Character and Player.Character:FindFirstChild("Torso") only calls :FindFirstChild if Player.Character is not nil or false. In that case, this statement never errors (well, unless Player is not a table/instance or Player is a table and the Character field is present and Player.Character does not have a function called FindFirstChild - but those errors are not likely to happen).
The other difference is that you can just call a function: 'a()' is a valid statement if a is a function. a or b is not a valid statement though, you need to do something with it:
a = a or b
z = d and c
b = not r
Those statements are valid.