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

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

Asked by 7 years ago

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

Log in to vote
1
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

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)
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 jonathan3576 12 — 7y
Ad

Answer this question