Is there a way to edit a script within a script? [For Plugin]

Hey, I want to know how to edit edit a script based on user input in a plugin, but I don’t know how to do that. I checked out Script.Source and StudioService.ActiveScript, but I don’t know how those work. If someone could explain them to me or show me an easier way, it would mean a lot to me. Thanks!

Script.Source is the source (text inside) of the script. You can read from and write to Script.Source. StudioService.ActiveScript is equal to the script the studio user is currently editing (if they have one open).
I’m not entirely sure what you need help with, so if this hasn’t solved your problem then please clarify.

I will clarify for you:

I understand Script.Source now but I want to do something like this:

newScript.Source = {"scripting stuff
scripting stuff
scripting stuff
scripting stuff"}

Like I want to put multiple lines of code in there
I just don’t know if this is possible or not

ScriptEditorService
Forum Post
API Reference

1 Like

As in something like this?

newScript.Source = [[scripting stuff
scripting stuff
scripting stuff
scripting stuff]]

would i have to put quotations?

No, quotations (“” or ‘’) are for single line strings, whereas brackets ([[]]) are used for multi line strings, which is likely what you want in this case.

Thanks, I’ll try it out and see if it works

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.