I was just revisiting my old games, and I found this piece of code here:
local shopParts = workspace.shopParts:GetChildren() for i,v in pairs(shopParts) do v.Touched:Connect(function(hit) -- Code that opens shop gui, etc. end) end
iirc, I was a stupid 9 year old that wanted to learn to code in roblox, and I did, well, stuff that isn’t very… RAM friendly.
Although, it has many parts in it. Like, about 20. Imagine how many lines it would’ve took to connect one-by-one.
So, the question is, is there any problem with using a for loop to connect events for multiple objects?
Thanks in advance! (＾▽＾)