Created
January 6, 2025 01:13
-
-
Save lamarmarshall/c936a978c9facee44c19980b6376d9f0 to your computer and use it in GitHub Desktop.
Roblox, lua, for loop, while loop, change color, random
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local cubes = game.Workspace.ColorCubes:GetChildren() | |
for i = 1, #cubes do | |
cubes[i].Color = BrickColor.Random().Color | |
end | |
local function changeColor() | |
r1 = math.random(0.0, 1.0) | |
r2 = math.random(0.0, 1.0) | |
r3 = math.random(0.0, 1.0) | |
return Color3.new(r1, r2, r3) | |
end | |
local iter = 1 | |
while iter < 20 do | |
for i = 1, #cubes do | |
cubes[i].Color = changeColor() | |
end | |
wait(1) | |
iter += 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment