I develop plugins, and one of the ideas I like the most is the ability to change a default script text into something else. However, I have no idea how to accomplish this.
✓ ANSWER ACCEPTED
How do I change the text of a script with a plugin?
1 answer
✓ Accepted answer
Assuming it's the Source of the script you wish to edit, not the actual font of the script-editor.
You can edit the Source of a script by accessing it through the Source-property (script.Source). It's important to note that regular scripts do not have the security clearance to set .Source anymore, but plugins (and commandline(?)) do.
I assume you want to replace the default "Hello world!"-print, so I made an example of how you could achieve that.
mySource = "-- This script was edited with ChipioIndustries' plugin. "
replaceTemplate = [[print 'Hello world!'\n]] -- This is the default template.
-- Adding a ChildAdded-event to ServerScriptService, so this can be applied to all newly created children (or newly re-parented)
game:GetService("ServerScriptService").ChildAdded:connect(function(child)
if child:IsA("BaseScript") or child:IsA("ModuleScript") then -- Makes sure it's a script
if child.Source == replaceTemplate then -- Checks if source matches template
child.Source = mySource -- replaces source.
end
end
end)
HOWEVER, if you did mean to edit the font, you can take use of settings(). I'll post back with results if I find anything further.
1 comment
0
No, I didn't mean the font. Thanks a ton!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I don't know how you'd do this with a plugin, but there is an area in Settings that allows you to change the font.
So do you want to change the actual source of the script, or just the font etc.? There might be some APIs for the latter.