How to call a function on Multiple parts

HI! I have a simple function that makes a part shrink. But I am wondering how I can make multiple parts shrink in a function, without having to define every single one. For example, How could I make every single part in the game shrink in one function.

while true do
	game.Workspace.Part.Size = game.Workspace.Part.Size - Vector3.new(0.125,0,0.125)
	wait(0.1)
end

You can first fetch all of the desired parts by making a table. If they’re in a folder, for example, it would just be the children of the folder (please ask me if you’d like me to explain that to you).

Once you have that table of parts, you can run a for loop on the parts, iterating through each one, and doing the desired effects, as shown in this example:

local Parts = Folder:GetChildren()

for int, part in pairs(Parts) do
    part.Size -= Vector3.new(0.125, 0, 0.125)
end
2 Likes

Thank you, this definitely makes sense and now I can achieve what I wanted to do.

1 Like