They can essentially be the same thing.
For example, when checking a boolean value:
local bool = true
Both would check to see if bool == true:
if bool then
if bool == true then
By doing if bool then, you're basically telling the conditional statement to check for bool == true in this scenario. If you did this...
if not bool then
...then you telling the statement to check for not true, which is essentially bool == false. Efficiency is, therefore, almost entirely ignored when doing this.
When checking to see if a userdata exists, you can then feed the condition the object directly:
local inst = script.Parent:FindFirstChild("Humanoid")
if inst then
In this scenario, if inst then is equivalent to if inst ~= nil then, which can also be viewed as if (inst ~= nil) == true then since inst ~= nil will evaluate to either true or false.
"Efficiency" is not a relevant factor here. It's just simpler to do either one of these things:
if inst then
if not inst then
if bool then
if not bool then
As compared to:
if inst ~= nil or bool == true then
if inst == nil or bool == false then
47 comments
wonderful question
wonderful question
wonderful question
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
i hope my answer helps
who upvoted all those comments
who upvoted all those comments
You shouldn't worry about very small optimizations unless you really need to.