local player = game.Players.LocalPlayer
while not player.PlayerGui do wait() end
I'm not sure what the while not means ``
local player = game.Players.LocalPlayer
while not player.PlayerGui do wait() end
I'm not sure what the while not means ``
"While" is asking if something is true or false. As long as it's true, it'll keep doing whatever is under it. If it's false, it'll stop. The "not" just negates the condition being evaluated. Instead of running if it's true, the not makes it so it only runs when it's false. So, in your case there, as long as the playergui doesn't exist the while loop will keep running.
while not tells the script to keep doing its given instruction(s) inside the loop until the condition associated with the not keyword no longer occurs. In your script, you're telling it to keep waiting until the player's PlayerGui exists. An alternative way to go about this is to simply use a repeat (...) until loop:
repeat wait() until player.PlayerGui
This is the same as while but it's just slightly clearer than while. You're telling the script to repeat the action given (yielding (waiting) in this example) until the player's PlayerGui exists.
The keyword not by itself negates the given condition, so that it checks for the opposite of that condition. Here is an example of that:
local number = 6
repeat
number = number + 1
until not (number % 5) > 0
The above is a repeat loop that keeps going until the remainder of the number in modulus division is not greater than 0 (this means it'll keep going until the number is 10). As previously mentioned, not reverses (negates) the given condition so that it will check for the opposite of it.
That is basically what you need to know about not.
Why did this get downvoted?
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
It will run as long as player.PlayerGui dosent exist