I don’t know how please don’t give me a whole script I just want an example
DevHub and YouTube
I am trying to learn this to see if I need it for a cooking system i’m gonna be adding in one of my games. But I do not understand how it works, I have seen a code model use it before but I don’t understand how it worked.
And I do not understand how to use for i,v in next, module do
I am trying to make it like this
foods.ChildAdded:Connect(function(child)
for i,v in next, foodmodule do
if child.Name == (meatNamesInTheMOdule) then
wait(meatNameWaitTime)
child.Color = (meatColorInMOdule)
end
end
end)
It’s less typing, some people like the look of it better, and it makes much more sense in certain ways
It used to have a slight performance benefit but with luau that’s lost, it was an inconsequential performance benefit anyways
If you want to go through the meats, you will want to use for i,v in next, foods["Meats] do.
Then you will have access to the index and values of each item. The index(i) will be the name and the table will be v. You can get v["Image"], v["Color"], etc from there.