Skip to content

Instantly share code, notes, and snippets.

@lamarmarshall
Created January 6, 2025 01:13
Show Gist options
  • Save lamarmarshall/c936a978c9facee44c19980b6376d9f0 to your computer and use it in GitHub Desktop.
Save lamarmarshall/c936a978c9facee44c19980b6376d9f0 to your computer and use it in GitHub Desktop.
Roblox, lua, for loop, while loop, change color, random
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