Macro to reset instances

I’m trying my /script ResetInstances() and it isn’t working, any suggestion?

Thanks