As of now, I've been using a mix of two:
method 1:
local condition1 = true local condition2 = true local condition3= true if condition1 and condition2 and condition3 then print("all conditions are true") end
method 2:
local condition1 = true local condition2 = true local condition3= true if condition1 then if condition2 then if condition3 then print("all conditions are true") end end end
Hi Marmalados,
method1 = 0 -- Will count how many times method 1 came out to be successful in the trials. method2 = 0 -- WIll count how many times method 2 came out to be successful in the trials. for x = 1, 100000 do -- Runs 100 thousand trials on the code. t1 = tick() if workspace:FindFirstChild("Script") and workspace:FindFirstChild("Baseplate") then end t1 = tick() - t1 t2 = tick() if workspace:FindFirstChild("Script") then if workspace:FindFirstChild("Baseplate") then end end t2 = tick() - t2 if t1 < t2 then -- If method 1 turned out to be faster then add points to method 1. method1 = method1 + 1 else method2 = method2 + 1 end end if method1 > method2 then -- If method 1 had more points then it is best. print("Method 1 is best.") else -- Otherwise method 2 is better. print("Method 2 is better.") end
Thanks,
Best regards,
KingLoneCat
The first statement is like, if yes and yes2 and yes3 then
runs the script, while method 2 is like if yes then (checkpoint) if yes2 then (checkpoint) if yes3 then (checkpoint)
as in consequently checking if they are all accompanied to each other, as in if the first yes is true, then check if the 2nd yes is true, vise versa.
I believe if you want a more-effecient based script, i'd prefer method 2 as in consequently running check-ups while proceeding throughout the script. Like I said, the method 1 is just to check at first if all method's are true to proceed, while method 2 is checking if the first if statement is true, to proceed to second if statement and so on.
Closed as Primarily Opinion-Based by User#19524
This question has been closed because it is a discussion about a topic focused on diverse opinions, which isn't a good fit for our Q&A format.
Why was this question closed?