Hello there, for my script I’m wanting to do this. When you spawn in a car it should be able to randomly pick the color and have a chance for that color to be picked.
For Ex:
(If the color red chance was a 0, it wouldn’t get picked at all meaning I don’t want it to pick that color. However with a color like a blue with a chance of 5, it’s more likely to pick that color then the red color with a 0% chance)
Unsure of how this could be written with code.
--local RN = BrickColor.random()
--script.Colors.Value = RN
Colortable = { {"Really Black",10},
{"Black",5},
{"Bright red",1},
{"Lily White",1},
{"Institutional white",1},
{"Bright green",1},
{"Deep blue",1},
{"Pine Cone",1},
}
PaintObject = script.Parent
PainterPart = "1"
Randomize = math.random(1,#Colortable)
for index, child in pairs(PaintObject:GetDescendants()) do
if child:IsA("BasePart") and child.Name == PainterPart then
child.BrickColor = BrickColor.new(Colortable[Randomize])--(Read here) This line of code will give out an error, all that's needed is to change this line of code here.
else end
end
Please do not write entire scripts or design entire systems.