I am making a cooking system where a UI tells you where to go. I tried to call functions from a table, but when I call pcall(foodTier["Cheese Pizza"][1]) it runs all the functions. Is there a better way to do this?
local foodTier={
["Cheese Pizza"]={
getPlate(),
getFridge(food.Dough),
getFridge(food.ColdCheesePizza),
getHeat(food.CheesePizza)
}
}
Basicly, I want each sub table in foodTier (which there are going to be a lot of them) to be a set of 4 different functions that get called one by one, but whenever I try to call one function, it calls them all.
local function getFridge (item: Instance)
step.Text="Go to the fridge"
print("fridge")
end
local function getPlate()
step.Text="Grab a plate"
print("plate")
end
local function getHeat(item: Instance)
step.Text="Go to the oven"
print("oven")
end
Where step is a textlabel. It doesn’t print anything, but it changes the text to `“Go to the oven”