Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

BrickColor gives random colors for the same number?

Asked by 7 years ago

I set a part to be a specific color with it's RGB values all the same, for example 255,255,255 or 122,122,122.

However it appears that when I run this script, it changes the RGB values to something like 123,143,151

local angleStrength = 7

math.randomseed(tick())

for i, v in pairs(workspace:GetChildren()) do
    if v.Name == "RockWall" then
        local colorValue = math.random(120,180)

        v.CFrame = v.CFrame * CFrame.fromOrientation(math.rad(math.random(-angleStrength,angleStrength)),math.rad(math.random(-angleStrength,angleStrength)),math.rad(math.random(-angleStrength,angleStrength)))

        v.BrickColor = BrickColor.new(Color3.fromRGB(colorValue,colorValue,colorValue))
    end
end

1 answer

Log in to vote
0
Answered by
Lolnox 47
7 years ago

The point is that you should change brick's Color, not the BrickColor. Like this

v.Color = Color3.new(colorValue, colorValue, colorValue)
0
GENIUS tobyjing2005 107 — 7y
Ad

Answer this question