I am looking for same script to generate script for User DB roles . Can you share if you have it now?
Or if anyone have it can share ?
I think the script I have posted here
should work. I just created an empty DB, added a table, added a new role, and issued a "grant select on dbo.table1 to test_role" and then executed the script.
The output I got back was under object level permissions for that role:
-- [-- OBJECT LEVEL PERMISSIONS --] --
GRANT SELECT ON [dbo].[table1] TO [test_role1]
Check that out and let me know if something is missing there.