ScriptDocument EditTextAsync parameters

so recently ScriptEditorService came out, and i have the idea to rewrite one of my plugin code

https://create.roblox.com/docs/reference/engine/classes/ScriptDocument#EditTextAsync
image
I don’t know what any of these do except for newText

The documentation is limited and I cannot seem to understand it

That’ll put newText the text on line startLine at startCharacter

And will end it on endLine at endCharacter

You’re basically setting the text of the script in a region you set (few lines, where to start at start line and where to end at end line)

For example,
Let’s say I run the following function on the script below:
EditTextAsync(“My new text”, 3, 8, 5, 2)

--Line 1
--Line 2
print("My old text") --Line 3
--M is the eigth character.
print("Part of this print will be deleted") --Line 5
--r is the second character.

Your new script would look like this:

--Line 1
--Line 2
print("My new text") 
int("Part of this print will be deleted")
--r is the second character.

You can see that the region I specified in the parameters was replaced with the text I chose

1 Like

ah, that makes sense now; i thought it was for editing the whole script :sweat_smile: