Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is "(function()" Used For?

Asked by
IcyEvil 260 Moderation Voter
10 years ago

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

1 answer

Log in to vote
1
Answered by
Gamenew09 180
10 years ago

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)
0
Oh THANKS I Will Use this A lot actually IcyEvil 260 — 10y
0
No problem Gamenew09 180 — 10y
Ad

Answer this question