local PlayerGui = game.Players.LocalPlayer.PlayerGui.ScreenGUI.Inventory.Slots:GetChildren()
local Ingredient = require(workspace.Ingredients)
local Screen = script.Parent.Parent.Options.Slots
script.Parent.MouseButton1Click:Connect(function()
for i,v in pairs(PlayerGui) do
print("Item name:".."/"..v.ItemName.Value.."/")
print("Ingredient table:",Ingredient)
print(Ingredient[v.ItemName.Value])
if v.ItemName.Value == Ingredient[v.ItemName.Value] then
local i = 0
repeat i+= 1 until(Screen[i].Occupied.Value == false)
Screen[i].Occupid = true
Screen[i].ItemName.Value = v.ItemName.Value
Screen[i].Count.Value = v.Count.Value
Screen[i].ItemImage.Image = v.ItemImage.Image
end
end
end)
This line: print(Ingredient[v.ItemName.Value]) prints nil, even when v.ItemName.Value is “Wheat Bundle”. I also checked the spelling and whitespace. That’s all good, but not this.
That’s not what I’m doing. The code is cycling through the player’s inventory slots and checking to see if any of those items fall under the category of “Ingredients”, and display that item on the screen to be selected to be used in with the molcajete I’m making. If you’re asking about i, all the slots are numbered, so it’s a way for me to cycle through the slots and check each one to see whether it meets the requirement.
If you are trying to get “Wheat Bundle” or “Flour Mound” from the table, no, but its the way you are setting the values that appears to be the issue.