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

How do i make one script wait for the output of another (without causing too much lag)?

I have not found any example on google about how to make scripts interact with each other. If someone can provide me with one little (commented) example. I will be very happy.

1 answer

✓ Accepted answer

You could use a BindableEvent, and :Fire() it from script 1. Then, in script 2, you can either do one of the following:

  1. Wait for the event to be fired.

  2. Bind a function to the event.

How would you do these things?

--Fire the event from script 1
BindableEvent:Fire()

--Wait for the event in script 2
BindableEvent.Event:Wait()

--Or, Connect to it in a function
BindableEvent.Event:Connect(functionName)

1 comment

0

The idea i want to understand is that. One Part tells the other it can do something (because an if statement) then from the other part, which receives info(already done that), can activate or stop the function remotelly

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