It should be:
game:GetService("ScriptEditorService").TextDocumentDidOpen:Connect(function(doc)
print("Opened", doc)
end)
and not:
game:GetService("ScriptEditorService").TextDocumentDidChange:Connect(
function(doc, changes)
print("Changed", doc, changes)
end)
Found on page,
Page URL: https://create.roblox.com/docs/reference/engine/classes/ScriptEditorService#TextDocumentDidOpen