So im trying to make a rarity gui, when a player kills the boss they get loot and depending on the loot they get the gui color would change for example if they got epic it would be purple or if they got legendary it would be yellow. And so im not sure how i can do that
local replicatedstorage = game:GetService("ReplicatedStorage")
local ArmorModule = require(game.ReplicatedStorage:WaitForChild("ArmorHandler"))
local remote = replicatedstorage.Events:WaitForChild("UpdateInventory")
local newArmor = ArmorModule.chooseRandom():Clone()
replicatedstorage.Events.UpdateInventory.OnClientEvent:Connect(function(player, armor)
local template = script.Parent.MainGui.InventoryHolder.Inventory.Templates.Template
local newTemplate = template:Clone()
newTemplate.Parent = script.Parent.MainGui.InventoryHolder.Inventory.Duplicates
local camera = Instance.new("Camera")
local armorname = newArmor.Name
local template2 = script.Parent.MainGui.Reward.Template
local newTemplate2 = template2:Clone()
newTemplate2.Parent = script.Parent.MainGui.Reward
camera.CFrame = CFrame.new(newArmor.PrimaryPart.Position + (newArmor.PrimaryPart.CFrame.lookVector * 3), newArmor.PrimaryPart.Position)
camera.Parent = newTemplate2.VP
newArmor.Parent = newTemplate2.VP
newTemplate2.VP.CurrentCamera = camera
script.Parent.MainGui.Reward.Visible = true
newTemplate2.Visible = true
wait(2)
script.Parent.MainGui.Reward.Visible = false
newTemplate2.Visible = false
newTemplate.Visible = true
camera.CFrame = CFrame.new(newArmor.PrimaryPart.Position + (newArmor.PrimaryPart.CFrame.lookVector * 3), newArmor.PrimaryPart.Position)
camera.Parent = newTemplate.VP
newArmor.Parent = newTemplate.VP
newTemplate.VP.CurrentCamera = camera
newTemplate:WaitForChild("ArmorName").Value = armorname
newTemplate.Name = armorname
end)
local RarityModule = require(--path to module)
local item = RarityModule["Legendary"]["ItemName1"] -- this return the first item.
-- then basically just find it through workspace or where it is via for loops;
for _,v in pairs(itemFolder:GetChildren()) do
if v.Name == item then
-- v is technically the physical object now, and just implement whatever here
local cloneObject = v:Clone() -- clone the object so that it drops
cloneObject.Parent == workspace -- this is an example of moving
-- then basically just do whatever with it
end
end)
-- Now to get its properties/settings within the item you can do this;
RarityModule["Legendary"]["ItemName1"]["Property1"]
--[[ now according to the module script, Property1 under 'ItemName1'
will return true.
]]
local module = require(--[[ path module here ]] )
local ArmorFolder = game.ReplicatedStorage:FindFirstChild("Armors")
function grabItem(Item, Folder)
local objItem
for _, v in pairs(Folder:GetChildren()) do
if v.Name == Item then
objItem = v
end
end
return objItem
end)
local Object = grabItem(module["Legendary"]["FirstItem"], ArmorFolder)
Object.Parent = workspace
-- etc etc etc