I’m super stressed out right now. I don’t know what to do. I already found all of my items and figured out their costs and set up the purchase gui, I just… have no idea what to do next.
Here’s the section of the inventory code that handles item values (I think? I followed a tutorial):
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DropItem = ReplicatedStorage:WaitForChild("DropItem")
wait (1)
local player = game.Players.LocalPlayer
local Inventory = player.Inventory
local MainGui = script.Parent
local InventoryGui = MainGui.InventoryGui
for i, itemValue in pairs(Inventory:GetChildren()) do
itemValue.Changed:Connect(function()
local itemGui = InventoryGui.ItemList:FindFirstChild(itemValue.Name)
if itemGui then
itemGui.ItemQuantity.Text = itemValue.Value
if itemValue.Value <= 0 then
itemGui.Visible = false
else
itemGui.Visible = true
end
end
end)
end
for i, itemButton in pairs (InventoryGui.ItemList:GetDescendants()) do
if itemButton:IsA("ImageButton") then
itemButton.MouseButton2Up:Connect(function()
local itemFrame = itemButton.Parent
local itemValue = Inventory:FindFirstChild(itemFrame.Name)
if itemValue.Value > 0 then
local DropItem = DropItem:InvokeServer(itemFrame.Name)
if DropItem == true then
if itemValue.Value > 0 then
itemFrame.ItemQuantity.Text = itemValue.Value
else
itemFrame.Visible = false
end
end
end
end)
end
end
If anyone thinks they could help me figure this out, THANK YOU