Hello, I wanted to make a automatic rarity system that takes the stringvalue of an item, gets its rarity and then it SHOULD set the background color of the item, but it doesn't because im getting an error. The script:
local guipart = script.Parent.GuiPart local StatsFolder = script.Parent.Stats local rarity = StatsFolder.Rarity local itemname = StatsFolder.ItemName local newRarity = string.upper(rarity.Value) local newName = string.upper(itemname.Value) print(workspace.RarityColors.Background.COMMON.Value.R * 255, workspace.RarityColors.Background.COMMON.Value.G * 255, workspace.RarityColors.Background.COMMON.Value.B * 255) guipart.ItemInfoGUI.Background.Rarity.Text = newRarity guipart.ItemInfoGUI.Background.ItemName.Text = newName guipart.ItemInfoGUI.Background.BackgroundColor3.R = Color3.new(workspace.RarityColors.Background[newRarity].Value.R * 255) guipart.ItemInfoGUI.Background.BackgroundColor3.G = Color3.new(workspace.RarityColors.Background[newRarity].Value.G * 255) guipart.ItemInfoGUI.Background.BackgroundColor3.B = Color3.new(workspace.RarityColors.Background[newRarity].Value.B * 255) guipart.ItemInfoGUI.Overline.BackgroundColor3 = Color3.new(workspace.RarityColors.Overline[newRarity].Value)
It's exactly as it says...The color value "R," or "Red," cannot be assigned to... neither can Blue nor Green. It's better to do it together, like this
guipart.ItemInfoGUI.Background.BackgroundColor3 = Color3.new(workspace.RarityColors.Background[newRarity].Value.R * 255, workspace.RarityColors.Background[newRarity].Value.G * 255, workspace.RarityColors.Background[newRarity].Value.B * 255)
Here is the wiki for Color3 values: https://developer.roblox.com/en-us/api-reference/datatype/Color3