When a player’s ReplicationFocus
goes near a model with ModelStreamingMode
set to PersistentPerPlayer
, the model permanently replicates to them. I have StreamingMinRadius
and StreamingTargetRadius
set to 64 and StreamOutBehavior
set to Opportunistic
.
My game uses a custom system where character graphics are communicated over remote events and created client-side. I’ve manually replicated character positions/rotations over RemoteEvents for years, and I recently made the switch to the new model:AddPersistentPlayer
/model:RemovePersistentPlayer
methods. I was really excited for this.
I managed to hack the behavior I need by not setting player.ReplicationFocus, but there are still issues:
-
Models still do not unreplicate when RemovePersistentPlayer is called. However, if I parent the model to nil then back to the workspace, it seems to unreplicate. This trick does not work when
ReplicationFocus
is set for the player we are replicating/unreplicating the NPC to. -
Some players are now crashing consistently. Their RAM usage skyrockets to 8gb+ while the client is frozen. Probably because Replication focus is not set, but I recently started using Actors/multithreading on the client so it could be that. (It seems to happen when lots of characters are on screen and the ragdoll animation starts simulating client-side. For the ragdolls I do lots of
actor:SendMessage
calls to set up water simulation for the parts.)
One of the users reporting this issue says they have dump files. -
Players are experiencing graphical glitches with client-created smooth terrain used for water and grass details. I assume this is because
ReplicationFocus
is not set. It could be due toStreamOutBehavior
being set toOpportunistic
though.
I should probably clarify that my entire map is replicated manually over remote events and is constructed client-side with my own streaming system. These NPC models are the only parts in my entire game that are replicated using StreamingEnabled. The server has a physics-only version of the map initialized within a Camera
instance.
Expected behavior
Ideally the PersistentPerPlayer
should not replicate to the client unless model:AddPersistentPlayer
is called, and model:RemovePersistentPlayer
should cause it to unreplicate. If this is not the intended behavior, I would appreciate an additional ModelStreamingMode with this behavior. It’s just more stable and gives low level control. It’s a waste of server and client resources to have these parts streaming when they don’t need to be. There are valid use cases for manual model streaming like this, for example private player homes or special rewards that appear for specific players.
Even so, the model should un-replicate when it leaves StreamingMaxRadius
, so long as the player is not in the persistent player list and StreamOutBehavior
is set to Opportunistic
.