Hello all,
I am creating a cooking system for my restaurant where players will be interacting with models and GUIs.
Below is an excerpt of my menu (Format: [Food Item Name] = {Ingredients})
["Meals"] = {
["Fish and Chips"] = {"Cooked Fish", "Cooked Chips"},
}
I will add some context first before I state my question so you can understand.
For the player to make the fish and chips, the player will grab all the ingredients (raw fish etc) and cook them. All ingredients go into the cooking inventory. When a player clicks on a “cooked” item, it will add that item to separate “selected items” gui.
In the “selected items” GUI, it will contain the ingredients listed above
When the player clicks on submit, the system will match the selected ingredients to the food item (being Fish and Chips). How would I go about matching the ingredients in the selected GUI to the food name in the table?
Here is what I have tried so far:
local menu = require(game.ReplicatedStorage.Menu)
local selectedfood = ""
for a,b in pairs (menu.Meals) do
for c,d in pairs (script.Parent.Selected.Items:GetChildren()) do
if d:IsA("TextButton") then
if #d:GetChildren() == #b then
selectedfood = a
end
end
end
end
I have no idea whether this is even right, but this doesn’t work for me. If anybody could possibly guide me I would be very much appreciated.
Thank you very much.