So, I am a beginner at scripting and wanted to try something out that I learned using the basics. I wanted to make an endless supply of brick to spawn and stack before falling, and I wanted all of them to be different colors. I got the spawning right, but only the first brick changes color. How do I fix this?
while true do Instance.new("Part", Workspace) game.Workspace.Part.BrickColor = BrickColor.Random() wait(0.1) end
game.Workspace.Part
is fine and dandy when there's only one Part in workspace. But when there's more than one Part in workspace, how does the script know which one you want? It doesn't.
What you need to do is save the Part you just created in a variable, and then use that variable to change its color. This way you will always be changing the color of the Part that was just created.
while true do local newPart = Instance.new("Part", Workspace) newPart.BrickColor = BrickColor.Random() wait(0.1) end