How do I fix this?

Long story short, I want to be able to paste the following LocalScript into as many Frames as I want and for the visibility state of the frames to save when a player leaves and joins. Currently, if a Frame changes visibility, it affects all of the other Frames with the LocalScript. Is there any way to fix this? I am going to provide the LocalScript and ServerScript below. Lmao for what it’s worth I will donate 1k robux to whoever can solve this issue I have been at it for a long time

Local:


Server:

are all of your frames inside another frame?

Yes! However, I want to be able to use this script in several Frames though because not all of them are located under one Frame. The Frame that holds all of these Frames is located within a Frame that is located within a Frame and so on. I will provide the hierarchy.


These frames will be cloned under other frames as well

To fix the issue where changing the visibility of one frame affects all other frames with the same LocalScript, you need to ensure that each frame is treated individually. Here’s how you can achieve this:

  1. Unique Identifiers: Ensure each frame has a unique identifier (ID) so that their states are tracked separately.
  2. Separate Attribute Tracking: Use attributes on the player to track visibility states for each frame independently.
  3. Independent Visibility Updates: Ensure the visibility updates are handled based on each frame’s unique ID, both on the client and the server.

Steps to Implement:

  1. Assign Unique IDs: Assign a unique ID to each frame upon creation if they don’t already have one.
  2. Attribute-Based Visibility: Store the visibility state for each frame using player attributes that incorporate the frame’s unique ID.
  3. Individual Attribute Listeners: Listen for changes to these attributes separately for each frame and update visibility accordingly.
  4. Server Synchronization: When a frame’s visibility changes, communicate this specific change to the server along with the frame’s unique ID. The server should then broadcast this change to all clients, ensuring only the relevant frame’s visibility is updated.

By ensuring that each frame has a unique identifier and managing their visibility states separately, you can prevent changes to one frame from affecting others.

image

I’m just going over what the ai said

Edit: mb, not “going over”, i just took what the ai said and put it here

but the ai is garbage, it cant do anything right

I mean, it’s not completely

because it gave me a script one time that was really cool. It was around a 267 line script.

I have unfortunately tried all of that and I cannot seem to get it :frowning:

well when you hide a frame that has other frames inside of it, it automatically hides all the frames inside of it. so the only solution i can think of is to add stringvalues to each frame. when each frame’s visibility state changes, the stringvalue inside the frame changes to either “visible” or “invisible”. the script will then check which stringvalues are set to “visible” or “invisible” and set the stringvalue’s parent (the frame) to the correct visibility state.