I have 2 variables and i want code to run when both of them are true. But for some reason even when both of them are true the code doesnt run, i have tried putting different code inside the statement but none of it will run. I have tried "while a==true do print(a)" and it says its true, sane with the other variable, but for some reason the code will not run, please help
COMMUNITY QUESTION
why doesnt my " IF a==true AND b== true THEN" not work?
1 answer
So you want a code to run/get triggered after a value is set to true? You can do this by making a loop, using setmetatable and making a boolvalue that you can :GetPropertyChangedSignal.
Assuming you're new to scripting, I'll just make a loop for you as it's the easiest, but not the best thing to use in terms of optimised code.
local Bool = false;
spawn(function()
while wait() do
if Bool == true then
print("true");
break; -- This will break the loop, making the loop run only once when the bool is set to true.
end;
end;
end);
wait(.3)
Bool = true;
This discussion is preserved as it was. New answers, comments, and votes are closed.
