hello i am trying to do maths on color3, but for some reasons i get some weird colors, here is my script and a screenshot of what i get
local leaf = Instance.new("Part",sadzonka)
leaf.Color = Color3.fromRGB(moduledrzewa.kolory.liscie.R+math.random(moduledrzewa.tolerancjakoloruliscia.min,moduledrzewa.tolerancjakoloruliscia.max),moduledrzewa.kolory.liscie.G+math.random(moduledrzewa.tolerancjakoloruliscia.min,moduledrzewa.tolerancjakoloruliscia.max),moduledrzewa.kolory.liscie.B+math.random(moduledrzewa.tolerancjakoloruliscia.min,moduledrzewa.tolerancjakoloruliscia.max))
tried printing moduledrzewa.kolory.liscie.R and got this:
Luaction
(Luaction)
May 1, 2021, 7:09pm
#3
Color3.R, Color3.G and Color3.B always give you a value in the range from 0 to 1.
Multiply that value with 255 if you want to use them in Color3:fromRGB
I think the reason you get such variation is that when you chose the .R, .G and .B from the thing, it takes it as a number between 0 and 1. Try this.
local leaf = Instance.new("Part", sadzonka)
leaf.Color = Color3.fromRGB(
(moduledrzewa.kolory.liscie.R * 255) + math.random(moduledrzewa.tolerancjakoloruliscia.min, moduledrzewa.tolerancejakoloruliscia.max)
(moduledrzewa.kolory.liscie.G * 255) + math.random(moduledrzewa.tolerancjakoloruliscia.min, moduledrzewa.tolerancejakoloruliscia.max)
(moduledrzewa.kolory.liscie.B * 255) + math.random(moduledrzewa.tolerancjakoloruliscia.min, moduledrzewa.tolerancejakoloruliscia.max)
)
sorry for the late answer, but yeah that was the issue. thanks a lot!