I’ve looked all over the place and haven’t found a direct API for this, am I missing something or is there not a way to detect this?
1 Like
What do you mean by the Undo’s / Redo’s in the script editor do you mean like if you make a change to your script and want to see the undo / redo logs. As of my knowledge I don’t believe there is one.
2 Likes
I’m trying to create a plugin that tracks a bunch of analytics like how many characters and lines you’ve created in specific Scripts and such, and I want to also track how many characters/lines have been undo’d and redo’d.
1 Like
You could try setuping up a function that runs every so often that can track the added or removed lines.
I don’t know if it will work but here is an example
Please know that this is not my code its help from the AI Roblox System. Also, roblox does not have an API for this. So please note that this code 100% could not work
function FOO(script)
local oldContent = script.Source
local changes = {
addedLines = 0,
removedLines = 0
}
script:GetPropertyChangedSignal("Source"):Connect(function()
local newContent = script.Source
local oldLines = string.split(oldContent, "\n")
local newLines = string.split(newContent, "\n")
local addedLines = 0
local removedLines = 0
for i = 1, math.max(#oldLines, #newLines) do
if oldLines[i] ~= newLines[i] then
if newLines[i] then
addedLines = addedLines + 1
end
if oldLines[i] then
removedLines = removedLines + 1
end
end
end
changes.addedLines = changes.addedLines + addedLines
changes.removedLines = changes.removedLines + removedLines
oldContent = newContent
end)
end
1 Like