Color is not a valid member of Workspace "Workspace"

I’m trying to run a command via the Roblox Studio command bar, that changes every part inside of the “Wood” folder (parented to workspace, only contains parts) to a slightly different color.

for i, v in pairs(game:GetChildren(workspace.Wood)) do
	math.randomseed(tick())
	v.Color.R = math.random(88,92)
	v.Color.G = math.random(74,78)
	v.Color.B = math.random(64,68)
end

When run, it outputs the error message Color is not a valid member of Workspace “Workspace”

Instead of this, use this:

workspace.Wood:GetChildren()

I dont think its possible to change specific R or B, G.
I guess it should be:

for i, v in pairs(workspace.Wood:GetChildren()) do
	math.randomseed(tick())
	v.Color = Color3.new(math.random(88,92),math.random(74,78),math.random(64,68))
end
1 Like

I somehow manage to disappoint myself yet again.
Thanks! I’ve done these loops so many times like that but for some reason right now I coded it in a way that doesn’t make any sense

1 Like

You are right about that, was just focusing on the first issue. Thanks for the help though! (it’s Color3.fromRGB btw if you are providing RGB values)

1 Like

You are right! Indeed both are Red, Green, Blue, but one is for decimals 0-1 and the other whole numbers 0-255

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.