While feces is primarily designed for server-to-client replication, it can be used in the reverse direction. This requires careful permission checking on the server to prevent clients from replicating data they shouldn’t be able to modify.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/NeonD00m/feces/llms.txt
Use this file to discover all available pages before exploring further.
Approach 1: Per-Player Entity Ownership
In this approach, each player gets their own dedicated entity (or set of entities) for every component they are allowed to replicate to the server. The ownership relationship is stored using a jecs pair:pair(replicated, replicated).
Server Setup
On the server, when you create an entity that a specific player owns, record the owning player by settingpair(replicated, replicated) to their Player instance:
Server Verification
When the server receives a packet from a client, verify that the entity in the packet actually belongs to the sending player before applying any changes:Approach 2: Component-Level Permission
For finer-grained control, you can grant a player permission to replicate a specific component on an entity rather than the entire entity. This usespair(replicated, someComponent) with the player as the value.
Server Setup
On the server, grant permission for a player to replicate a particular component on a given entity:Server Verification
When receiving a packet, filter incoming data component-by-component and verify the permission for each:Health component on their character entity but not the Position component, for example.
Client-Side Sending
In the meantime, you can replicate from the client to the server manually by callingfeces:delta() on the client feces instance and firing the resulting packet to the server through a RemoteEvent, where the server performs the permission checks described above before calling feces:apply().
Choosing an Approach
Per-entity ownership
Simpler to set up. Best when each player controls entire entities (e.g., a personal character
entity with all components owned by that player).
Per-component permission
More granular. Best when players should only be able to update specific components on shared
entities (e.g., voting on a shared entity, or updating only their own health on a team entity).