Hack to replicate instances on a client scope with respawn persistence

Not sure if anyone has come across the same problem but I am trying to replicate instances to the client which I do not want the other clients to be aware of; both for security as well as performance reasons. I’m unaware of an official solution to this problem.

This only really leaves 2 options AFAIK: Those being PlayerScripts and PlayerGui since the contents of Backpack are replicated to other clients. Manipulating instances on a client basis rules out PlayerScripts since it can’t be accessed by the server.

TL;DR Creating a ScreenGui with it’s ResetOnSpawn property set to false parented to the client’s PlayerGui allows you to use it as a container for said issue. It’s also a good idea to set it’s Enabled property to false.

Other clients will not see the contents of other client PlayerGuis and a player dying/respawning won’t change the container. Obviously this is a hack and can’t be guaranteed to work forever.

2 Likes

This is the method I use for replication. The client moves it’s ScreenGui into ServerStorage so that the PlayerGui is not cluttered with non-UI objects.

I don’t think this is classed as a hack, though. There’s a reason players cannot access others’ PlayerGuis. Although while not ideal, this is the most official solution (it’s the only Instance with a PlayerReplicated tag) we have for now without exposing objects to all players and wasting their resources.

This is a messy, WIP service for handling exactly this:

https://github.com/ClockworkSquirrel/ContainerService

3 Likes

If you’re looking for server>client replication, check out Replicate your states with ReplicaService! (Networking system)

Also, this isn’t really a tutorial per se, since the actual tutorial segment is a minor component of the overall thread + it’s a description, not really a step by step tutorial. Not quite sure where the best place would be, maybe #development-discussion ?

1 Like

@https_KingPie I like the idea behind ReplicaService, but I don’t really understand how to use it, especially with Instances.

@AgentVanBur I do agree that this is more of a tip and description rather than a tutorial. You need to develop a guide on how to use this trick to our advantage and why we should use it (over ReplicatedStorage). Code samples, screenshots and videos are always extremely helpful to include.