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

Is it possible to have one function that fires for multiple events? [closed]

Asked by 9 years ago

This question already has an answer here:

Have one function for several events?

Hello!

Lately I've been doing some GUI work. Though once I was done with it and was ready to create the GUI, I ran into an efficiency problem.

I have several frames that I need to tween the size and position of. Instead of using separate functions for each frame, could I condense it into one function that works for all of the frames?

Thanks, all replies are appreciated.

Marked as Duplicate by Merely, Sublimus, Spongocardo, and BlueTaslem

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

2 answers

Log in to vote
2
Answered by 9 years ago

All I could think of is making one function and then connecting them to different events using event:connect(function) I can't tell you if that'll work but it's worth a try.

Ad
Log in to vote
-2
Answered by 9 years ago

Try using the Spawn function ex.

Function Start() Spawn(function() print("Hello World") end) Spawn(function() print("This was printed at the same time as the one above") end) end

Output:

Hello World This was printed at the same time as the one above