Follower Replica
Based on game build 714014 | Last updated: 2026-03-03
Overview
Follower is a network-replicated component that tracks the relationship between an entity and its leader or item owner. It uses net_entity to synchronize leadership or item-ownership state across the network (server to client). This component is typically attached to follower entities (e.g., pets, minions, or items held by followers) to ensure consistent awareness of who they follow or serve on both sides of the network boundary.
Usage example
local inst = CreateEntity()
inst:AddComponent("follower_replica")
-- Set the leader entity
local leader = TheWorld.components.leaderboard:GetLeader()
inst.components.follower_replica:SetLeader(leader)
-- Or set an item owner
inst.components.follower_replica:SetItemOwner(someOwner)
-- Retrieve the effective leader (preferring item owner if set)
local effectiveLeader = inst.components.follower_replica:GetLeader()
Dependencies & tags
Components used: None identified
Tags: None identified
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
_leader | net_entity | nil | Networked reference to the entity's leader. |
_itemowner | net_entity | nil | Networked reference to the entity's item owner (higher priority than leader). |
Main functions
SetLeader(leader)
- Description: Sets the networked leader reference for this follower entity. The leader is used when no item owner is set.
- Parameters:
leader(entityornil) — the entity that acts as the leader, ornilto clear the reference. - Returns: Nothing.
SetItemOwner(owner)
- Description: Sets the networked item owner reference. This takes precedence over
_leaderwhen determining the effective leader viaGetLeader(). - Parameters:
owner(entityornil) — the entity that owns the item/follower, ornilto clear the reference. - Returns: Nothing.
GetLeader()
- Description: Returns the effective leader: the item owner if set, otherwise the leader. This is used for logic that needs a single authoritative "follow target".
- Parameters: None.
- Returns:
entity?— the effective leader entity, ornilif neither_itemownernor_leaderis set.
Events & listeners
- Listens to: None identified
- Pushes: None identified