Can you have more than one condition in a while true do loop?
while PrimaryPart.Position ~= desiredposition and AtBottom == false do --[[ My code Is Here --]] end
Yes you can.
You can have any number of expressions
separated by and
and or
. Another way of accomplishing this is by your expression
being a function call
.
Using a function
can help organize code, so that you do not have to do a lot of checks inline
.
Here is an example.
local counter = 0 local function iterate() counter = counter + 1 return counter <= 10 end while iterate() do print(counter) end
It the loop cycles until the function call
returns false
.
Yes you can sir! For example you could do
while Player.Character.Humanoid.Health > 0 and Player.Character.Humanoid.WalkSpeed > 0 do print(Player.Name .. " is alive and healthy." wait() end
This same thing also works with if and for statements
if Player.Character.Humanoid.Health > 0 and Player.Character.Humanoid.WalkSpeed > 0 then print(Player.Name .. " is alive and healthy." end