So in my game, there are small units that have their own list of targets which they have to move to and follow the path to in order. This is contained in their main script.
The client can select these units and there is a module that draws paths between all the targets for each unit. This means it needs to be able to call a function to get all the targets of all selected units.
So I have a remote function setup that does this call, and then the server receives the units that the client needs targets for. Then it loops through each unit and fires a BindableFunction to get the units target. The parameter here is the unit, and every unit checks to see if it is itself being called upon.
The issue is, Roblox only allows you to bind one function to them, meaning only one unit can work.
Is there any way around this or a better way to do the target system?
Some thoughts I had:
Units have a folder with vector3 values and each one is named in order
Only one bindable EVENT is fired with the list of units in question and all units check if they are being called on, if they are they fire another bindable event containing their target data, and then the server adds it to a big list of it all to return. (Not sure how this would work, but I think it allows me to bypass the one function limit)
Each time a new unit is created a new bindable function is created for that one by itself. (Issue here is you dont know what function is for what unit without some complex naming, maybe you could use Object values but that is slow)
Keep in mind, this is run every tick when the player has units selected.