Save Frame Visibility When Leaving and Rejoining

I am currently attempting to make a local script that saves the state of visibility for all frames located under the local script’s parent, which is a frame called MainFrame. I also added a script under ServerScriptService. There is a remote event called ‘VisibilityEvent’. I will attach the two scripts. Here is the Local Script:
Screenshot 2024-06-07 175238
Here is the ServerScriptService Script:


If anyone can help, I would greatly appreciate it! Thank you!