Help with a plugin

So I’m making a plugin to make scripting easier. The idea is that you select lines of code you want in your script. its added to a que and when you click create script it makes a script wich contains all the line that where inside the que. For instance if i add game:GetService(“TweenService”) to my que i want to create a script and write inside it game:GetService(“TweenService”).

But… the problem is i dont know how to write inside a script via plugin scripts.
when using javascript you can use :Write(Code) but roblox doesnt have this.

I’ve searched on google but i didnt really found a solution or comparable topics.

Does someone know how to write inside a script via my plugin? or if its even possible.

Scripts have a Source property that allows Plugins and the Command bar to write inside of a script, this property is protected, meaning attempting to use it in a script or a localscript will error.

ive searched for script.source to but i dont really know how to use it the roblox site does say it works with plugins but again i dont know how to use it.

Let me give an example of how it can be used.

Say you have a script in the workspace with the code

print("Hello World")

in the command bar if you do

workspace.Script.Source = "print('World Hello!')"

If I’m not mistaken it should turn the script’s contents into

print('World Hello!')

If you want to add a line into a new line in a script. You just use the \n character

workspace.Script.Source = "print('test!')\n\n(print('yay testing!')"

Will change the scripts’ contents into

print('test!')

print('yay testing!')
1 Like

thank you, this was exactly what i needed!

now i can work on my plugin again.

1 Like

Anytime! If you hae anymore issues don’t be afraid to make another post!

Hey, I am making my own Plugin too rn and I tried to use script.Source on a local script. For some reason it does not work.

instead of using \n you can use [[]] string like:
[[
if 1 + 2 == 3 then
print(‘asd’)
end
]]

1 Like