attempt to index nil with 'Rarity'
Error: Players.OsipStar4ik.PlayerGui.MainGui.Shop.CaseDisplay.Container.Manager:53: attempt to index nil with 'Rarity'
Please help me!!
-- goro7 -- Basic settings local FADED_COLOR = Color3.fromRGB(60, 60, 60) local plr = game.Players.LocalPlayer local commonColor = plr:WaitForChild("PlayerScripts"):WaitForChild("Functions"):WaitForChild("GetRarityColor"):Invoke("Common") local uncommonColor = plr:WaitForChild("PlayerScripts"):WaitForChild("Functions"):WaitForChild("GetRarityColor"):Invoke("Uncommon") local rareColor = plr:WaitForChild("PlayerScripts"):WaitForChild("Functions"):WaitForChild("GetRarityColor"):Invoke("Rare") local legendaryColor = plr:WaitForChild("PlayerScripts"):WaitForChild("Functions"):WaitForChild("GetRarityColor"):Invoke("Legendary") local godlyColor = plr:WaitForChild("PlayerScripts"):WaitForChild("Functions"):WaitForChild("GetRarityColor"):Invoke("Godly") function sortByName(x, y) -- Convert to lowercase local xString = string.lower(x.Value.Name) local yString = string.lower(y.Value.Name) -- Convert to byte values local xBytes = {} for i=1, string.len(xString) do table.insert(xBytes, string.byte(xString, i, i)) end local yBytes = {} for i=1, string.len(yString) do table.insert(yBytes, string.byte(yString, i, i)) end -- See if Y ever less than up X local xIsLess = false for i=1, #yBytes do if table.getn(xBytes) < i then xIsLess = true break end if xBytes[i] < yBytes[i] then xIsLess = true break elseif xBytes[i] > yBytes[i] then break end end -- Return result return xIsLess end function sortByRarityAndName(x, y) -- Assign numbers for rarity local rarityX = plr.PlayerScripts.Functions.GetRarityValue:Invoke(x.Value.Rarity.Value) local rarityY = plr.PlayerScripts.Functions.GetRarityValue:Invoke(y.Value.Rarity.Value) -- Sort by name if same if rarityX == rarityY then return sortByName(x, y) end -- Return comparison return (rarityX > rarityY) end script.Parent.ShowCase.Event:connect(function(case) -- Delete all currently listed items for _, i in pairs(script.Parent:GetChildren()) do if i.Name == "Item" then i:destroy() end end -- Create an item for each local entries = case.Contents:GetChildren() table.sort(entries, sortByRarityAndName) for n, i in pairs(entries) do local item = i.Value local itemGui = script.Parent.ItemTemplate:clone() itemGui.Name = "Item" itemGui.Item.Value = item itemGui.ItemIcon.Image = item.IconAsset.Value itemGui.ItemName.Text = item.Name itemGui.ItemRarity.Text = item.Rarity.Value itemGui.ItemName.TextColor3 = plr.PlayerScripts.Functions.GetRarityColor:Invoke(item.Rarity.Value) itemGui.Position = UDim2.new(0, ((n - 1) % 4) * 100 + 10, 0, math.floor((n - 1) / 4) * 100 + 10) itemGui.Parent = script.Parent itemGui.Visible = true itemGui.InteractionHandler.Disabled = false end -- Size the scrolling frame script.Parent.CanvasSize = UDim2.new(0, 0, 0, math.ceil(#entries / 4) * 100 + 20) -- Disable preview plr.PlayerGui.MainGui.Shop.Preview.PixelVerticalOffset.Value = -5 plr.PlayerGui.MainGui.Shop.Preview.Scale.Value = 24 plr.PlayerGui.MainGui.Shop.Preview.Item.Value = entries[1].Value -- Set up main case sidebar items local caseSidebar = script.Parent.Parent.Parent.CaseSidebar caseSidebar.Visible = true caseSidebar.BuyButton.Case.Value = case caseSidebar.Price.Text = case.Price.Value .. " " caseSidebar.Price.CoinImage.Position = UDim2.new(0.5, caseSidebar.Price.TextBounds.X / 2 - 13, 0, 4) -- Set percentages local total = case.CommonChance.Value + case.UncommonChance.Value + case.RareChance.Value + case.LegendaryChance.Value caseSidebar.CommonChance.Text = tostring((case.CommonChance.Value / total) * 100) .. "%" caseSidebar.UncommonChance.Text = tostring((case.UncommonChance.Value / total) * 100) .. "%" caseSidebar.RareChance.Text = tostring((case.RareChance.Value / total) * 100) .. "%" caseSidebar.LegendaryChance.Text = tostring((case.LegendaryChance.Value / total) * 100) .. "%" if case.GodlyChance.Value > 0 then caseSidebar.GodlyChance.Text = "???%" else caseSidebar.GodlyChance.Text = "0%" end -- Fade percentages if 0 if caseSidebar.CommonChance.Text == "0%" then caseSidebar.CommonChance.TextColor3 = FADED_COLOR caseSidebar.CommonChance.Label.TextColor3 = FADED_COLOR else caseSidebar.CommonChance.TextColor3 = commonColor caseSidebar.CommonChance.Label.TextColor3 = commonColor end if caseSidebar.UncommonChance.Text == "0%" then caseSidebar.UncommonChance.TextColor3 = FADED_COLOR caseSidebar.UncommonChance.Label.TextColor3 = FADED_COLOR else caseSidebar.UncommonChance.TextColor3 = uncommonColor caseSidebar.UncommonChance.Label.TextColor3 = uncommonColor end if caseSidebar.RareChance.Text == "0%" then caseSidebar.RareChance.TextColor3 = FADED_COLOR caseSidebar.RareChance.Label.TextColor3 = FADED_COLOR else caseSidebar.RareChance.TextColor3 = rareColor caseSidebar.RareChance.Label.TextColor3 = rareColor end if caseSidebar.LegendaryChance.Text == "0%" then caseSidebar.LegendaryChance.TextColor3 = FADED_COLOR caseSidebar.LegendaryChance.Label.TextColor3 = FADED_COLOR else caseSidebar.LegendaryChance.TextColor3 = legendaryColor caseSidebar.LegendaryChance.Label.TextColor3 = legendaryColor end if caseSidebar.GodlyChance.Text == "0%" then caseSidebar.GodlyChance.TextColor3 = FADED_COLOR caseSidebar.GodlyChance.Label.TextColor3 = FADED_COLOR else caseSidebar.GodlyChance.TextColor3 = godlyColor caseSidebar.GodlyChance.Label.TextColor3 = godlyColor end -- Set visiblities script.Parent.Parent.Visible = true script.Parent.Parent.Parent.Display.Visible = false script.Parent.Parent.Parent.Sidebar.Visible = false end) script.Parent.ReturnToPreviousView.Event:connect(function() -- Show previous preview plr.PlayerGui.MainGui.Shop.Preview.PixelVerticalOffset.Value = -2 plr.PlayerGui.MainGui.Shop.Preview.Scale.Value = 18 plr.PlayerGui.MainGui.Shop.Preview.Item.Value = nil -- Set visiblities script.Parent.Parent.Visible = false script.Parent.Parent.Parent.CaseSidebar.Visible = false script.Parent.Parent.Parent.Display.Visible = true script.Parent.Parent.Parent.Sidebar.Visible = true end)
Replace line 53/ 54 to:
local rarityX = plr.PlayerScripts.Functions.GetRarityValue:Invoke(x.Rarity.Value) local rarityY = plr.PlayerScripts.Functions.GetRarityValue:Invoke(y.Rarity.Value)
The reason why I think this might work is because Value is a property, and does not have a children.
Oh, also, if the name is really called Value then... do this:
local rarityX = plr.PlayerScripts.Functions.GetRarityValue:Invoke(x["Value"].Rarity.Value) local rarityY = plr.PlayerScripts.Functions.GetRarityValue:Invoke(y["Value"].Rarity.Value)