You might need some parentheses for this if
expression, to be entirely sure it does what you want it to do:
if not UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift) then
Because as how it is written (without parentheses), its truth table looks like this:
NOT 'LeftShift' OR 'RightShift' -> Result
-----------------------------------------
NOT false OR false -> true
NOT false OR true -> true
NOT true OR false -> false
NOT true OR true -> true
But if you add parentheses like this:
if not ( UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift) ) then
It becomes:
NOT ( 'LeftShift' OR 'RightShift' ) -> Result
-----------------------------------------
NOT ( false OR false ) -> true
NOT ( false OR true ) -> false
NOT ( true OR false ) -> false
NOT ( true OR true ) -> false
Here is a simple Lua script that proves it:
print("")
print("-- not leftShift or rightShift --")
for _,leftShift in ipairs({ false, true }) do
for _,rightShift in ipairs({ false, true }) do
local result = not leftShift or rightShift
print("NOT",leftShift,"OR",rightShift,"->",result)
end
end
print("")
print("-- not ( leftShift or rightShift ) --")
for _,leftShift in ipairs({ false, true }) do
for _,rightShift in ipairs({ false, true }) do
local result = not ( leftShift or rightShift )
print("NOT (",leftShift,"OR",rightShift,") ->",result)
end
end