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

Change slot background on rarity problem, how to fix it?

Asked by 2 years ago

So my script has a problem that I can't fix. I can't make the script work because I'm stuck with the table function and I cant make the locals normally. I attached some pictures and the code:

The Handler:

--------------------------------start
--local slots = mainframe:WaitForChild("Slots")
local raritybackgroundcolor = slots:GetChildren().RarityUISTROKE
local Rarity = itemsmodule.Rarity
local itemfind = itemsmodule.chooseRandom()
slots.GetChildren() 
do
    if table.find(itemsmodule.rarity["5"], itemfind) then--legendary
        slots.raritybackgroundcolor.Color3 = Color3.fromRGB(236, 127, 0)

    elseif table.find(itemsmodule.rarity["4"], itemfind) then--epic
        slots.raritybackgroundcolor.Color3 = Color3.fromRGB(138, 97, 255)


    elseif table.find(itemsmodule.rarity["3"], itemfind) then--Rare
        slots.raritybackgroundcolor.Color3 = Color3.fromRGB(14, 86, 255)


    elseif table.find(itemsmodule.rarity["2"], itemfind) then--UnCommon
        slots.raritybackgroundcolor.Color3 = Color3.fromRGB(17, 255, 76)


    elseif table.find(itemsmodule.rarity["1"], itemfind) then--Common
        slots.raritybackgroundcolor.Color3 = Color3.fromRGB(78, 70, 81)


end





---------------------------------end

The pictures:

How the GUI looks:

The ItemTable (Modulescript inside):

The code:

Answer this question