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

Event Listener (Event:Connect) without using Anonymous Functions ?

Asked by 6 years ago
brick = script.Parent
brick.Touched:connect(function(part)
    print("test")
end)

Is an example of an anonymous function. How would I use a pre existing function instead of writing down the function inline?

0
Please accept my answer if it solves your question. SebbyTheGODKid 198 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago
local function MyNormalFunction(part)
    print("test")
end
brick = script.Parent
brick.Touched:Connect(MyNormalFunction) -- :connect is deprecated, use :Connect instead.

easy-peesy

0
brick.Touced might not give you much, though.. :P protectiveebob 221 — 6y
0
he meant Touched, duh Gey4Jesus69 2705 — 6y
0
Thank you! In the Roblox wiki I never seen an example of an event that uses an already made function, they always use anon functions. Formidable_Beast 197 — 6y
0
No problem. SebbyTheGODKid 198 — 6y
Ad

Answer this question