I’ve tried to run the script with all of your suggestions (thanks by the way!), but I’ve encountered this random error that I have no idea why it is there and makes no sense.
Here it is.
EDIT: I’ve fixed this bug now.
if the the issue is solved you should mark someone as the solution