I tried to make a selling process in Roblox and wanted to make a selling & stealing system. Simply put, when you steal the item, it goes into a folder. Then when you sell, I have a for loop and the way I want to process to go is however many items are in the folder, that is how much money you get. script:
local Items = game.Workspace["BackpackCurrency's"]:GetChildren()
game.Workspace["Seller man"].UpperTorso.ProximityPrompt.Triggered:Connect(function()
for i, v in pairs(Items) do
game:GetService('Players').LocalPlayer.leaderstats.Credits.Value = game:GetService('Players').LocalPlayer.leaderstats.Credits.Value + tonumber(i)
end
end)
local Items = game.Workspace["BackpackCurrency's"]
game.Workspace["Seller man"].UpperTorso.ProximityPrompt.Triggered:Connect(function(player)
player.leaderstats.Credits.Value += #(Items:GetChildren())
Items:ClearAllChildren()
end)