local Item = script.Parent.Item
local Price = script.Parent.Price
local Currency = script.Parent.Currency
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local CurrencyName = player.leaderstats:FindFirstChild(Currency.Value)
local ItemName = game.ReplicatedStorage.LootCrate[math.random]
if CurrencyName.Value >=Price.Value then
CurrencyName.Value = CurrencyName.Value - Price.Value
ItemName:Clone().Parent = player.StarterGear
ItemName:Clone().Parent = player.Backpack -- dont change anything here
end
end)
This is the script that I am using to do this. It is supposed to be like a loot-box that you can buy, and it chooses a random tool from the folder in Replicated Storage. The folder is named "Lootcrate"

3 comments
thanks mate, your help is greatly appreciated B)
np. thanks for taking the time to respond back
noice