What's the difference between while true to,for do, and while wait do?
Example: while wait() do Brick.BrickColor = BrickColor.Random()
What does while wait do and why does it need () between wait and do and () after random?
What's the difference between while true to,for do, and while wait do?
Example: while wait() do Brick.BrickColor = BrickColor.Random()
What does while wait do and why does it need () between wait and do and () after random?
Here are some examples for your questions..
--The while true do loop is a loop that always repeats the same thing; until break
--The for is used in numerous ways.. Here is an example
for i = 1,10,0.1 do wait()
game.Workspace.Base.Transparency = game.Workspace.Base.Transparency -i
end
--What that did is it subtracted the Base's transparency by 0.1 which is found in the 'for'
--You can also do
for i = 1,#game.Players:GetPlayers() do
print(i)
end
--This prints the amount of the players in numbers.
--If you are trying to make the BrickColor change, try this..
while true do
game.Workspace.Base.BrickColor=BrickColor.new(math.random(1,255))
wait()
end
--or
while wait() do
game.Workspace.Base.BrickColor=BrickColor.new(math.random(1,255))
end
--or in another format
for i = 1,math.huge do wait()
game.Workspace.Base.BrickColor=BrickColor.new(math.random(1,255))
end
For more info and help check the Wiki and Loops
Hope I helped!
-BloxSimple
This discussion is preserved as it was. New answers, comments, and votes are closed.