Closure

A function that keeps using the local variables that were in scope where it was created.

Think of it as A backpack of variables a function carries with it.

When a function is written inside another function, it can read and change the outer function's locals, and they stay alive as long as the inner function does. Event handlers are usually closures: CoinService's Touched handler keeps its coin's claimed flag and seen set. Each call of the outer function creates fresh locals.

Official reference: create.roblox.com

Related terms