Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is "(function()" Used For?

I see it In A lot of scripts I dont understand what It is used for Or how To use it.

1 answer

✓ Accepted answer

Those are called anonymous functions, they allow you to use less lines to connect to an event.

Example:

game.Workspace.Part.Touched:connect(function (hit) -- Anonymous Function
	-- Do stuff here...
end)

2 comments

0

Oh THANKS I Will Use this A lot actually

0

No problem

This discussion is preserved as it was. New answers, comments, and votes are closed.