Hello guys. Can someone help me make ImageLabel a photo of the selected Unit?
local unitRarity = {
unseenItems = towers:WaitForChild("UnseenItems"):GetChildren(),
mythicalItems = towers:WaitForChild("MythicalItems"):GetChildren(),
legendaryItems = towers:WaitForChild("LegendaryItems"):GetChildren(),
veryrareItems = towers:WaitForChild("VeryRareItems"):GetChildren(),
rareItems = towers:WaitForChild("RareItems"):GetChildren(),
uncommonItems = towers:WaitForChild("UncommonItems"):GetChildren(),
commonItems = towers:WaitForChild("CommonItems"):GetChildren()
}
local weights = {
Common = 100,
Uncommon = 35,
Rare = 20,
VeryRare = 10,
Legendary = 1,
Mythical = 0.1,
Unseen = 0.01
}
local function UpdateUnitsBanner(unitNames, weights)
local UnitsBanner = game.Players.LocalPlayer.PlayerGui.Banner.BannerFrame.UnitsBanner
for _, child in ipairs(UnitsBanner:GetChildren()) do
if child:IsA("ImageLabel") then
child:Destroy()
end
end
for _, unitName in ipairs(unitNames) do
local unitLabel = Instance.new("ImageLabel")
unitLabel.Name = unitName
unitLabel.Size = UDim2.new(0, 80, 0, 80) -- Default size
unitLabel.Parent = UnitsBanner
unitLabel.Image = towers[unitRarity[unitName]].Config.Image.Texture
end
end
function getAvailableItems(day)
local rng = Random.new(day)
local shopItems = {}
local selectedItems = {}
while #shopItems < 6 do
local item = nil
local category = rng:NextNumber(0, 100)
if category < weights.Unseen then
item = unitRarity.unseenItems[rng:NextInteger(1, #unitRarity.unseenItems)]
elseif category < weights.Mythical then
item = unitRarity.mythicalItems[rng:NextInteger(1, #unitRarity.mythicalItems)]
elseif category < weights.Legendary then
item = unitRarity.legendaryItems[rng:NextInteger(1, #unitRarity.legendaryItems)]
elseif category < weights.VeryRare then
item = unitRarity.veryrareItems[rng:NextInteger(1, #unitRarity.veryrareItems)]
elseif category < weights.Rare then
item = unitRarity.rareItems[rng:NextInteger(1, #unitRarity.rareItems)]
elseif category < weights.Uncommon then
item = unitRarity.uncommonItems[rng:NextInteger(1, #unitRarity.uncommonItems)]
else
item = unitRarity.commonItems[rng:NextInteger(1, #unitRarity.commonItems)]
end
if not selectedItems[item.Name] then
table.insert(shopItems, item.Name) -- Store item names instead of instances
selectedItems[item.Name] = true
end
end
return shopItems
end