I have a inventory system which has a gui, so when you kill a item it goes into a table and is displayed on the gui.
I want to Make a shop in which will sell all items in the players inventory folder and then clear it.
Here is the shop gui script
script.Parent.MouseButton1Click:Connect(function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
ReplicatedStorage.Remotes.Sell:FireServer()
end)
Here is the what gets loaded on to the table when there needed.
local ItemsInfo = {
["item1"] = {
Price = 200;
};
["item2"] = {
Price = 10;
};
return ItemsInfo
Table is in sever scrips
local Inventory = { }
Here is the main problem
RepStorage.Remotes.Sell.OnServerEvent:Connect(function(item, player)
local itemInfo = ItemsInfo[item]
local Sum = itemInfo.Price
Sum = 0
for i,v in pairs(itemInfo) do
Sum = Sum + v
end
if Sum > 0 then
local player = game.Players.LocalPlayer
player.leaderstats.Teccers.Value = player.leaderstats.Teccers.Value + Sum
end
end)
Please try and help, Or at least give something

3 comments
ok thank you ill do that
It didn't fix it, its having an error: Attempt to index nil with 'Price'
I saw this coming. In the first code block on line 5, you didn't send over the item in parameters. In other words, the parameters are empty.