Hey, so I’ve been thinking about making a recipe system for my portfolio such as in Frappe where you mix together ingredients in a cup to make different drinks. I’d say this is very easy to make but extremely time consuming for the way I would do it. If I were to make it there would be an incredible amount of if then statements like this:
script.Parent.Touched:Connect(function(hit)
if hit.Parent.Name == "Cup" then
hit.Parent.Name = "Milk"
elseif hit.Parent.Name == "Coffee" then
hit.Parent.Name = "Coffee with milk"
elseif hit.Parent.Name == "Sugar" then
hit.Parent.Name = "Sugary milk"
end
end)
If there were a lot of recipes there would be a lot of elseif statements and I feel like this is extremely inefficient and there is a much better way to accomplish this. If somebody could help me that would be greatly appreciated. Thanks!