Rarity system not working

I have been working on my shop and added tiers/rarity, so for an easier management of the colors i made a folder with the colors of each tier, here is the script for changing colors:

local Rar = script.Parent
local Image = Rar.Parent.ImageShow
local Colors = script.Parent.Parent.Parent.Parent.Parent.RarityColors
local Rtext = script.Parent.Parent.RarityText

if Rar.Value == 0 then
	Image.BackgroundColor3 = Color3.new(Colors.CommonColor.Value)
	Rtext.TextColor3 = Color3.new(Colors.CommonColor.Value)
	Rtext.Text = "Common"
else if Rar.Value == 100 then
	Image.BackgroundColor3 = Color3.new(Colors.StarColor.Value)
	Rtext.TextColor3 = Color3.new(Colors.StarColor.Value)
	Rtext.Text = "Star!"

I selected an item as Star to test the colors but when i tested the game, the text and the background were black. The Star tier color is like a light yellow. I hope you can help me, thanks.

2 Likes

You should use Color3.fromRGB instead of Color3.new and then paste the value. Try it out, this code:

local Rar = script.Parent
local Image = Rar.Parent.ImageShow
local Colors = script.Parent.Parent.Parent.Parent.Parent.RarityColors
local Rtext = script.Parent.Parent.RarityText

if Rar.Value == 0 then
	Image.BackgroundColor3 = Color3.fromRGB(Colors.CommonColor.Value)
	Rtext.TextColor3 = Color3.fromRGB(Colors.CommonColor.Value)
	Rtext.Text = "Common"
else if Rar.Value == 100 then
	Image.BackgroundColor3 = Color3.fromRGB(Colors.StarColor.Value)
	Rtext.TextColor3 = Color3.fromRGB(Colors.StarColor.Value)
	Rtext.Text = "Star!"
1 Like

They are still black.

30chars

May you try to use this code valueses? (for color)

1 Like

I use values so i can edit the tiers more easier. BrickColors aren’t for blocks also?

Don’t use a Color3 constructor. What does Colors refer to, a container full of Color3 value objects? Set the colors of your objects to the raw value of the Color3Value object. For example, BackgroundColor3 of Rarity value 0:

Image.BackgroundColor3 = Colors.CommonColor.Value
1 Like

Those are RGB colors it should work in anyway if you are calling Color3.fromRGB(r,g,b).

1 Like