I am making a game where users can create their own enemies from preset AI programs, but I had plans to introduce a Visual Scripting system into my project so that users can program more advanced and customised AI for their needs.
However, I’m not 100% sure how to go about this. My plan is to basically make the Visual Scripter a large module of Functions that, when compiled, writes these functions to a script, in the correct order and with any parameters requested, and then put the script into the NPC or targeted object.
I was going to use script.Source but I forgot that only the command bar and plugins can write to it, so now I’m not really sure how I can introduce a Visual Scripter and have it compile into working code.
Is there some way I can either set the script’s Source, or use the visual code to make some kind of “Fake script” that runs in the same way?
I don’t really want to limit users to just choosing from presets.
I did look into this prior and someone mentioned using
loadstring but that’s a deprecated function for saving data, so I don’t really understand why that was mentioned, unless I’m missing something.