In your first example, the Size property is passed and assigned to your variable by value. Meaning, the current value of the Size property is stored, and when it changes, the size the variable stores will not change with it. So when you assign a new value to the size variable, you’re expecting it to affect the actual part’s size, but rather, it’s just assigning a new Vector3 to the variable that you have. So in theory, it doesn’t work, but it actually is doing what it’s supposed to do. Hopefully this makes a bit of sense.
local part = script.Parent
local size = part.Size
while task.wait() do
size = part.Size
part.Size = Vector3.new(size.X + 1, size.Y + 1, size.Z + 1)
end
the first one does actually store the size of the part in the size variable. It’s just that you can’t change the size of part as a variable. Setting size to those numbers will only change size to those numbers and not part.Size