So there are quite a few Plugins like Code Minimap - Roblox that can spot you writing in a Script. They even know on which line you are writing your code in. I wanted to detect in which line of Script user is currently in.
So this is a really complex concept to understand. Especially when Roblox doesn’t give you the best tools to do plugins.
I am not saying they’re bad, but they’re not the best compared to VSCode and other softwares
I don’t really know how to do this to be honest, but I’m pretty sure there’s a tutorial out there teaching these concepts. I’ll link one if I can find a tutorial!
Actually, the only abilities plugins have support for is setting and reading Script.Source, and opening a script to a certain line using Plugin:OpenScript(line). You can’t detect the current editing position. The plugin you mentioned can only send you to a certain line, it can’t detect it.
This has been a feature request for quite a while: Plugin script cursor methods
Okay, how do you think they managed to detect a line you are currently in?
Are you sure? I have the plugin myself and it doesn’t appear to have that ability.
The best you could do is listen for the source changing, find the location of the change, and decide that’s the current selected line, which wouldn’t be very accurate.
See feature request reply from the creator of the plugin:
Oh yes it doesn’t seem to get the line of the Script. It does get the edited Script tho.
I will see the topic and look into it more.
Edit: here’s what I found: StudioService | Documentation - Roblox Creator Hub
Beyond the OpenScript method and ActiveScript property there is no way to interact with the script editor.
However, you can listen to the Source property changing. Some plugins may use this and diff the old source and new source to figure out where a change was. The downside of this approach is changing the source from code will reset the script cursor (or at least that used to be the case) so there’s not much you can do unfortunately.