How to return stuff from a running loop in a module?
lets say a script fired a function from a module script, that runs a loop, but every time it loops I want it so it returns something that the script that fired it can change
How to return stuff from a running loop in a module?
lets say a script fired a function from a module script, that runs a loop, but every time it loops I want it so it returns something that the script that fired it can change
If you want to communicate from one server/module-script to another multiple times, I would recommend using a BindableEvent.
isnt it very cost efficient to fire that like every heartbeat?
Depends on what’s being done. Returning a regular value should be fine, anything more complex you might run into some issues with.
wouldnt returning a value break the loop?, id like to return values that can be modified by the script and sent back to the loop
no he is right here. from my personal experience changing or creating parts, especially if you are indexing a string is very slow. i couldnt find a solution for creating parts but if you save the instance to a array it’s fast that way