I'm trying to create an inventory GUI. This GUI has a button that when clicked opens a Frame, this Frame holds the inventory(Slots,Items).
In the Inventory there is another Frame, this is the Slot where the item will be held. In this frame we have a number value for the amount of the item in the inventory.
When the player clicks a certain Object in the game I want this Value to Increase + 1 and to Change the asset ID of the imagelabel to whatever it should be.
Here is what I have.
Object's Click Detection Script. This is a local script inside a ClickDetector inside a brick.
local inv = game:GetService("StarterGui").GameGui.MainFrame.Inventory.InvtFrame
local invparts = inv:GetChildren()
local plr = game.Players.LocalPlayer
script.Parent.Parent.ClickDetector.MouseClick:connect(function(plr)
local plr = game.Players.LocalPlayer
if plr then
for i, v in pairs(invparts) do
wait (0.5)
if v.SlotValue.Value == "" then
v.SlotValue.Value = "Wood"
v.Amount.Value = 0
v.SlotValue.Text = v.Amount.Value
v.SlotImage.Image = "http://www.roblox.com/asset/?id=539465370"
break
elseif v.SlotValue.Value == "Wood" then
v.Amount.Value = v.Amount.Value + 1
v.SlotLabel.Text = v.Amount.Value
break
end
end
end
end)?
The setup of the Inventory is: ScreenGUI<Frame<Textbutton<InvtFrame<ASlot<SlotValue, Amount, SlotLabel, SlotImage

1 comment
Still does not work but Thanks for the information!