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

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

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?

1 comment

0

Please accept my answer if it solves your question.

1 answer

✓ Accepted answer
local function MyNormalFunction(part)
	print("test")
end
brick = script.Parent
brick.Touched:Connect(MyNormalFunction) -- :connect is deprecated, use :Connect instead.

easy-peesy

4 comments

0

brick.Touced might not give you much, though.. :P

0

he meant Touched, duh

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.

0

No problem.

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