Okay, so I have so far managed to create a script using instance. How do I put code into the newly added script from the main script or is it even possible?
You can’t edit the scripts Source
using a regular game script, you will have to use a plugin or the command bar.
But could you explain why you want to hardcode in a script’s source?
So it is not possible to create a script using instance and then put things in the script?
Not without a plugin or the command bar, no. But what is this for?
Just trying out some different things for a new project that came to mind, not being able to create a new script and insert code into it is kind of preventing me from going further at the moment. Thanks for your help anyway
Doing a quick Google-search got me this result, which I think should answer your question:
Short answer: It’s currently impossible to edit the source of a script using a script. But, you could use loadstring() (not recommended)
Edit: The content from that link is 2 years old, though… not sure if things are still applicable.
That’d be a really cool feature, though.
First of all, welcome to the DevForum! Appears it’s your first post here
Secondly, while it may be convenient in certain scenario’s, it can also be malicious I think.
Hackers might be able to create, take or edit a script, insert code much easier and deal some real bad damage to your game.
Thanks for the warm welcome! I’m happy to be here. I can’t wait to look for some work in the next few months.
I suppose you’re right; however, I feel like Roblox could definitely mobilize some new security measures to prevent that. Guess we’ll see in the future!
Thanks again for the welcome.