### Configure and Initialize Chrono Source: https://parihsz.github.io/Chrono/getting-started/configurations Demonstrates how to create a shared configuration module to register entity types and models, and how to initialize the Chrono system in the main script. ```Lua -- Shared/ChronoConfig.lua local Config = require(PATH_TO_CHRONO.Shared.Config) Config.SetConfig("DEFAULT_NORMAL_TICK_DISTANCE", 100) Config.SetConfig("DEFAULT_HALF_TICK_DISTANCE", 200) Config.SetConfig("REPLICATE_DEATHS", "PLAYER_CHARACTERS") Config.RegisterEntityType("FAST_ENTITY", { TICK_RATE = 1 / 60, FULL_ROTATION = true, }) Config.RegisterEntityType("SLOW_ENTITY", { TICK_RATE = 1 / 20, FULL_ROTATION = true, }) Config.RegisterEntityModel("NPC", PATH_TO_NPC_MODEL) Config.RegisterEntityModel("NPC_WITH_CULL", PATH_TO_NPC_MODEL,Vector3.new(4,4,4)) return nil ``` ```Lua -- MAIN SCRIPT local chrono = require(PATH_TO_CHRONO) chrono.Start(Shared.ChronoConfig) ``` -------------------------------- ### Initialize Chrono on Client and Server Source: https://parihsz.github.io/Chrono/getting-started/start-chrono This snippet demonstrates how to initialize the Chrono library by requiring the module from ReplicatedStorage and calling the Start method. This process enables Chrono's replication and snapshot interpolation features for the respective environment. ```Luau (Client) local ReplicatedStorage = game:GetService("ReplicatedStorage") require(ReplicatedStorage.Packages.chrono).Start() ``` ```Luau (Server) local ReplicatedStorage = game:GetService("ReplicatedStorage") require(ReplicatedStorage.Packages.chrono).Start() ``` -------------------------------- ### Chrono Default Configuration Values Source: https://parihsz.github.io/Chrono/getting-started/configurations Provides the base configuration table used by Chrono, defining default buffer limits, replication distances, and entity behavior settings. ```Lua local BASE_CONFIG = { __VERSION = "v2.0.0", CHECK_NEW_VERSION = true, MIN_BUFFER = 0.09, MAX_BUFFER = 0.5, QUERY_RADIUS = 100, DEFAULT_NORMAL_TICK_DISTANCE = 50, DEFAULT_HALF_TICK_DISTANCE = 100, PLAYER_REPLICATION = "AUTOMATIC", REPLICATE_DEATHS = "PLAYER_ENTITIES", REPLICATE_CFRAME_SETTERS = "PLAYER_ENTITIES", DEFAULT_MODEL_REPLICATION_MODE = "NATIVE", SEND_FULL_ROTATION = false, SHOW_WARNINGS = false, MAX_SNAPSHOT_COUNT = 30, } ``` -------------------------------- ### Set Player Replication Mode Source: https://parihsz.github.io/Chrono/getting-started/configurations Configures how player characters are handled within the replication system, either automatically or via custom management. ```Lua PLAYER_REPLICATION = "AUTOMATIC" ``` -------------------------------- ### Define Chrono Entity Types Configuration Source: https://parihsz.github.io/Chrono/getting-started/configurations Configuration for different entity types in Chrono, specifying replication modes, tick rates, buffer times, and other replication-related settings. Requires a 'NAME' field if modifying the config table directly. ```lua local ENTITY_TYPES = { DEFAULT = { NAME = "DEFAULT", TICK_RATE = 1 / 30, BUFFER = 0.1, }, WITH_ROT = { NAME = "WITH_ROT", TICK_RATE = 1 / 2, BUFFER = 0.1, FULL_ROTATION = true, }, PLAYER = { NAME = "PLAYER", MODEL_REPLICATION_MODE = "NATIVE_WITH_LOCK", BUFFER = 0, -- dynamically handled TICK_RATE = 1 / 20, }, } ``` -------------------------------- ### Entity CFrame Management Source: https://parihsz.github.io/Chrono/reference/entity Methods for getting and setting the CFrame of an entity, including interpolation and direct updates. ```APIDOC ## GetAtTime ### Description Gets the interpolated CFrame of this entity at the given time. Returns nil if no data. ### Method GET ### Endpoint /websites/parihsz_github_io_chrono/Entity/GetAtTime ### Parameters #### Path Parameters - **time** (number) - Required - The timestamp to get the interpolated CFrame for. ### Response #### Success Response (200) - **CFrame?** - The interpolated CFrame at the specified time, or nil. ## GetTargetRenderTime ### Description Gets the target render time for this entity based on buffer settings. Returns 0 if no buffering. ### Method GET ### Endpoint /websites/parihsz_github_io_chrono/Entity/GetTargetRenderTime ### Response #### Success Response (200) - **number** - The target render time. ## SetAutoUpdatePosition ### Description Sets whether Chrono will automatically call `Entity.Push` when the entity model moves. ### Method POST ### Endpoint /websites/parihsz_github_io_chrono/Entity/SetAutoUpdatePosition ### Parameters #### Request Body - **autoUpdate** (boolean) - Required - Whether to automatically update position. ## GetCFrame ### Description Gets the latest CFrame of this entity. Will first check `self.latestCFrame` then fall back to the model's PrimaryPart CFrame if available. ### Method GET ### Endpoint /websites/parihsz_github_io_chrono/Entity/GetCFrame ### Response #### Success Response (200) - **CFrame?** - The latest CFrame of the entity, or nil. ## SetCFrame ### Description This will move the entity instead of interpolating it. ### Method POST ### Endpoint /websites/parihsz_github_io_chrono/Entity/SetCFrame ### Parameters #### Request Body - **cframe** (CFrame) - Required - The CFrame to set the entity to. ## GetPrimaryPart ### Description Gets the PrimaryPart of the entity's model, if available. ### Method GET ### Endpoint /websites/parihsz_github_io_chrono/Entity/GetPrimaryPart ### Response #### Success Response (200) - **BasePart?** - The PrimaryPart of the entity's model, or nil. ``` -------------------------------- ### Set or Get Entity Model Source: https://parihsz.github.io/Chrono/reference/entity Manages the model associated with an entity. This function allows setting a new model (or a model string name for custom replication) and optionally controlling whether the previous model is destroyed. It also provides a way to retrieve the current model. ```lua -- Set a new model Entity.SetModel(self, game.Workspace.AnotherModel, "CUSTOM_REPLICATION", true) -- Get the current model local currentModel = Entity.GetModel(self) ``` -------------------------------- ### Register Entity Model with Chrono Source: https://parihsz.github.io/Chrono/getting-started/configurations Registers a reusable entity model with Chrono. This function defines a model that can be used for specific entity types, with optional broadphase settings for culling. Entity models can be registered dynamically after Chrono.Start. ```lua Entity.RegisterEntityModel(name: string, model: Model|BasePart, broadphase: Vector3?) ``` -------------------------------- ### Set Up Collision Groups for Ragdolls (Lua) Source: https://parihsz.github.io/Chrono/guides/ragdolls Configures collision groups using Roblox's PhysicsService to ensure ragdoll parts interact correctly with the world and other entities. It prevents ragdolls from colliding with active combatants while allowing them to collide with the environment and each other. This setup is crucial for preventing physics glitches during ragdoll events. ```lua local PhysicsService = game:GetService("PhysicsService") PhysicsService:RegisterCollisionGroup("Combatants") PhysicsService:RegisterCollisionGroup("Combatants2") PhysicsService:RegisterCollisionGroup("Ragdoll") PhysicsService:CollisionGroupSetCollidable("Combatants2", "Combatants", false) PhysicsService:CollisionGroupSetCollidable("Combatants2", "Combatants2", false) PhysicsService:CollisionGroupSetCollidable("Ragdoll", "Default", true) PhysicsService:CollisionGroupSetCollidable("Ragdoll", "Combatants", false) PhysicsService:CollisionGroupSetCollidable("Ragdoll", "Combatants2", false) PhysicsService:CollisionGroupSetCollidable("Ragdoll", "Ragdoll", true) Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) for _, part in character:GetDescendants() do if part:IsA("BasePart") then part.CollisionGroup = "Combatants" end end end) end) ``` -------------------------------- ### Manage Entities via API Source: https://parihsz.github.io/Chrono/guides/migration Demonstrates the transition from the v1 NpcRegistry-based workflow to the unified v2 Entity class API for creation, positioning, and destruction. ```Lua (v1) local id = NpcRegistry.Register(model, "NPC",nil,true) NpcRegister.SetPosition(id, cframe) SetPosition.SetNetworkOwner(id, player) local latestCFrame = Replicate.GetLatestCFrame(id) NpcRegistry.UnRegister(id) ``` ```Lua (v2) local entity = Entity.New("NPC",modelOrpartOrModelName) Entity.SetCFrame(entity, cframe) Entity.SetNetworkOwner(entity, player) local latestCFrame = entity.latestCFrame Entity.Destroy(entity) ``` -------------------------------- ### Create and Register a New Entity Source: https://parihsz.github.io/Chrono/reference/entity Initializes a new Entity instance with optional configuration, model, replication mode, and initial CFrame. The entity is automatically registered upon creation. ```lua local newEntity = Entity.new("MyConfig", game.Workspace.MyModel, nil, CFrame.new(0, 10, 0)) ``` -------------------------------- ### POST /Server.ServerClock/ConvertTo Source: https://parihsz.github.io/Chrono/reference/serverclock Converts a timestamp between server and client environments for a specific player to maintain time synchronization. ```APIDOC ## POST /Server.ServerClock/ConvertTo ### Description Converts a timestamp from server time to client time or vice versa for the given player to ensure accurate synchronization. ### Method POST ### Endpoint /Server.ServerClock/ConvertTo ### Parameters #### Request Body - **player** (Player) - Required - The player object to convert the time for. - **clock** (number) - Required - The timestamp value to convert. - **environment** (string) - Required - Specify "Server" to convert from client time to server time, or "Client" to convert from server time to client time. ### Request Example { "player": "PlayerInstance", "clock": 1625097600, "environment": "Client" } ### Response #### Success Response (200) - **timestamp** (number) - The converted timestamp value. #### Response Example { "timestamp": 1625097605 } ``` -------------------------------- ### Registering a Player Character and Setting Network Ownership Source: https://parihsz.github.io/Chrono/guides/npcs Demonstrates how to initialize a new entity as a player character and assign network ownership to a specific player. This ensures the client receives correct camera logic and control over the entity. ```Luau character.Archivable = true local newEntity = Entity.new(config, character, modelRepMode) Holder.SetAsCharacter(player, newEntity) Entity.SetNetworkOwner(newEntity, player) ``` -------------------------------- ### Snapshot Buffer Methods Source: https://parihsz.github.io/Chrono/reference/snapshots API methods for interacting with the snapshot buffer, including data insertion and retrieval. ```APIDOC ## POST /Shared.Snapshots/Push ### Description Inserts a snapshot into the buffer. Maintains chronological order and automatically overwrites the oldest entries when the buffer is full. ### Method POST ### Endpoint /Shared.Snapshots/Push ### Parameters #### Request Body - **t** (number) - Required - The timestamp of the snapshot. - **value** (T) - Required - The snapshot data to store. --- ## GET /Shared.Snapshots/GetLatest ### Description Retrieves the most recent snapshot currently stored in the buffer. ### Method GET ### Endpoint /Shared.Snapshots/GetLatest ### Response #### Success Response (200) - **SnapshotData** (object) - The most recent snapshot or nil if empty. --- ## GET /Shared.Snapshots/GetAt ### Description Returns the interpolated value at a specific timestamp. It handles linear interpolation between snapshots and wrap-around logic for timestamps between 0 and 255. ### Method GET ### Endpoint /Shared.Snapshots/GetAt ### Parameters #### Query Parameters - **t** (number) - Required - The target timestamp for interpolation. - **bypassLock** (boolean) - Optional - If true, ignores locks on the buffer to allow retrieval. ### Response #### Success Response (200) - **T** (any) - The interpolated value at the requested timestamp. --- ## POST /Shared.Snapshots/Clear ### Description Removes all entries from the snapshot buffer. ### Method POST ### Endpoint /Shared.Snapshots/Clear ``` -------------------------------- ### Chain Mount Entities (Chrono) Source: https://parihsz.github.io/Chrono/guides/mounting Demonstrates chaining multiple mounts to create nested relationships, such as attaching an arm to a body, and a hand to the arm. The system resolves the full chain by walking up to the root and applying offsets back down, with caching for efficiency. This function is server-only. ```Chrono Entity.SetMount(arm, body, cframe) Entity.SetMount(hand, arm, cframe) --etc ``` -------------------------------- ### Register Custom Player Entity Source: https://parihsz.github.io/Chrono/guides/migration Demonstrates how to manually create and assign a player entity when using the CUSTOM configuration mode. This process involves creating the entity, setting it as the player's character, and assigning network ownership. ```Luau local newEntity = Entity.new(config, character, modelRepMode :: any) Holder.SetAsCharacter(player, newEntity) Entity.SetNetworkOwner(newEntity, player) ``` -------------------------------- ### Create and Synchronize Entity Data Source: https://parihsz.github.io/Chrono/guides/npcs Demonstrates how to instantiate an entity on the server with custom metadata and retrieve that data on the client when the entity is added to the game world. ```Luau -- Server local myEntity = Entity.new("Entity", "BasicR6Rig") Entity.SetData(myEntity, { HAIR_COLOR = "Bright red", HAIR_STYLE = "Curly", }) --- Client local function ApplyHairStyle(model: Model, hairColor: string, hairStyle: string) -- apply the hairstyle to the model end Events.EntityAdded:Connect(function(entity) local data = Entity.GetData(entity) local hairColor = data.HAIR_COLOR local hairStyle = data.HAIR_STYLE local model = entity.model ApplyHairStyle(model, hairColor, hairStyle) end) ``` -------------------------------- ### Configure Chrono Entities Source: https://parihsz.github.io/Chrono/guides/migration Compares the v1 direct table modification approach with the v2 functional API for setting configuration values and registering entity types. ```Lua (v1) local Config = ... Config.SHOW_WARNINGS = false Config.NPC_TYPES.NPC = { TICK_RATE = 1 / 30 } ``` ```Lua (v2) local Config = ... Config.SetConfig("SHOW_WARNINGS", false) Config.RegisterEntityType("NPC", { TICK_RATE = 1 / 30 }) ``` -------------------------------- ### Define Entity Configuration Types Source: https://parihsz.github.io/Chrono/guides/migration Shows the expansion of entity configuration properties from the limited v1 type definition to the more comprehensive v2 input structure. ```TypeScript (v1) export type NPC_CONFIG = { BUFFER: number, TICK_RATE: number, } ``` ```TypeScript (v2) export type EntityConfigInput = { BUFFER: number, TICK_RATE: number, FULL_ROTATION: boolean?, AUTO_UPDATE_POSITION: boolean?, STORE_SNAPSHOTS: boolean?, MODEL_REPLICATION_MODE: MODEL_REPLICATION_MODE?, NORMAL_TICK_DISTANCE: number?, HALF_TICK_DISTANCE: number?, CUSTOM_INTERPOLATION: boolean?, } ``` -------------------------------- ### Register and Unregister Middleman Functions Source: https://parihsz.github.io/Chrono/reference/receiver Functions to manage middleman callbacks that intercept entity updates. RegisterMiddleMan allows custom logic to block or modify updates based on priority, while UnregisterMiddleMan removes them by name. ```Luau -- Registering a middleman RegisterMiddleMan("AntiCheat", 10, function(player, entity, cframe, time) -- Return true to block the update return false end) -- Unregistering a middleman UnregisterMiddleMan("AntiCheat") ``` -------------------------------- ### Configure Entity Properties Source: https://parihsz.github.io/Chrono/reference/entity Allows modification of various entity properties such as its configuration, broadphase settings, and custom data. These methods are used to fine-tune entity behavior and data replication. ```lua -- Set entity configuration Entity.SetConfig(self, "NewEntityType") -- Set broadphase for culling Entity.SetBroadPhase(self, Vector3.new(100, 100, 100)) -- Set custom data Entity.SetData(self, { score = 100, playerName = "Player1" }) -- Get custom data local entityData = Entity.GetData(self) ``` -------------------------------- ### Register Custom Entity Models Source: https://parihsz.github.io/Chrono/guides/npcs Shows how to register different model representations for the same entity across server and client environments using CUSTOM replication mode. ```Luau --server.luau Config.RegisterEntityModel("TestChar", Instance.new("Part")) --client.luau Config.RegisterEntityModel("TestChar", Path.To.Model) ``` -------------------------------- ### Configure PrimaryPart for R6 Rigs (Lua) Source: https://parihsz.github.io/Chrono/guides/ragdolls Sets the HumanoidRootPart as the PrimaryPart for R6 rigs to avoid potential bugs and enable optimizations within the Chrono system. This configuration must be applied immediately upon character addition to be processed correctly by Chrono. ```lua character.PrimaryPart = character:WaitForChild("HumanoidRootPart") ``` -------------------------------- ### Control Network Ownership and Replication Source: https://parihsz.github.io/Chrono/reference/entity Manages which player or server has network ownership of an entity and controls the replication process. This includes setting network owners, pausing, and resuming replication. ```lua -- Set network owner on the server local player = game.Players.LocalPlayer Entity.SetNetworkOwner(self, player) -- Pause replication Entity.PauseReplication(self) -- Resume replication Entity.ResumeReplication(self) ``` -------------------------------- ### Remount Entity to New Parent (Chrono) Source: https://parihsz.github.io/Chrono/guides/mounting Allows changing the parent of an already mounted entity without needing to clear the previous mount first. The entity will adopt the new parent with the specified CFrame offset. This function is server-only. ```Chrono Entity.SetMount(follower, newparent, CFrame.new(0, 0, 5)) ``` -------------------------------- ### Configuring Entity Tick Rates and Distance Zones Source: https://parihsz.github.io/Chrono/guides/npcs Shows how to define custom entity types with specific tick rates and distance-based replication thresholds. This allows for bandwidth optimization by reducing updates for distant entities. ```Luau Config.RegisterEntityType("NPC", { TICK_RATE = 1 / 30, -- Replicates every 1/30th of a second (30 hz) NORMAL_TICK_DISTANCE = 50, -- Full updates up to 50 studs (30 hz) HALF_TICK_DISTANCE = 150, -- Half updates up to 150 studs (15 hz) }) local myNPC = Entity.new("NPC",...) ``` -------------------------------- ### REPLICATE_DEATHS Configuration Source: https://parihsz.github.io/Chrono/guides/npcs Configure how entity deaths are replicated to the server. Options include `PLAYER_ENTITIES`, `PLAYER_CHARACTERS`, and `NATIVE`. ```APIDOC ## REPLICATE_DEATHS Configuration ### Description When set to `PLAYER_ENTITIES` or `PLAYER_CHARACTERS`, the server will automatically destroy the entity when the player's character dies. This addresses potential issues with death state replication in `NATIVE` mode. **Warning:** It is recommended to use `PLAYER_CHARACTERS` to prevent users from destroying other entities they own. ### Method Not applicable (Configuration setting) ### Endpoint Not applicable (Configuration setting) ### Parameters #### Query Parameters - **REPLICATE_DEATHS** (enum: `PLAYER_ENTITIES`, `PLAYER_CHARACTERS`, `NATIVE`) - Required - Specifies the death replication mode. ### Request Example Not applicable (Configuration setting) ### Response #### Success Response (200) Not applicable (Configuration setting) #### Response Example Not applicable (Configuration setting) ``` -------------------------------- ### Manage Entity Mounting Source: https://parihsz.github.io/Chrono/reference/entity Handles the hierarchical relationship between entities. An entity can be mounted to another entity with an optional CFrame offset, or its mount can be cleared. ```lua -- Mount entity to another entity local parentEntity = ... -- Get the parent entity local offset = CFrame.new(0, 5, 0) Entity.SetMount(self, parentEntity, offset) -- Clear the mount Entity.ClearMount(self) ``` -------------------------------- ### Entity Replication Control Source: https://parihsz.github.io/Chrono/reference/entity Methods for controlling native server CFrame replication for entities. ```APIDOC ## LockNativeServerCFrameReplication ### Description Locks the native server CFrame replication for this entity's model. Only applies to SERVER context and NATIVE model replication mode. ### Method POST ### Endpoint /websites/parihsz_github_io_chrono/Entity/LockNativeServerCFrameReplication ## UnlockNativeServerCFrameReplication ### Description Unlocks the native server CFrame replication for this entity's model. Only applies to SERVER context and NATIVE model replication mode. ### Method POST ### Endpoint /websites/parihsz_github_io_chrono/Entity/UnlockNativeServerCFrameReplication ``` -------------------------------- ### Mount Entity with Offset (Chrono) Source: https://parihsz.github.io/Chrono/guides/mounting Attaches an entity (follower) to another entity (carrier) with a specified CFrame offset. The follower will then move with the carrier. This function is server-only. ```Chrono Entity.SetMount(follower, carrier, CFrame.new(5, 0, 0)) ``` -------------------------------- ### Entity Events Source: https://parihsz.github.io/Chrono/reference/entity Details on the events that can be fired by an entity. ```APIDOC ## Events These events can be accessed via `Entity.GetEvent(self,eventName)`. ### Destroying Fired when the entity is being destroyed. ### NetworkOwnerChanged Fired when the network owner of the entity changes. Provides the new Player or nil. - **newOwner** (Player?) - The new network owner player or nil. - **prevOwner** (Player?) - The previous network owner player or nil. ### PushedSnapShot Fired when a new snapshot is pushed to the entity. - **time** (number) - The timestamp of the pushed snapshot. - **value** (CFrame) - The CFrame value of the pushed snapshot. - **isLatest** (boolean) - Whether this snapshot is the latest one. ### TickChanged Fired when the tick rate of the entity changes. - **newTickType** (string) - The new tick type name. - NONE - No ticking - NORMAL - Normal tick rate - HALF - Half tick rate ### DataChanged Fired when the custom data of the entity changes. - **newData** (any) - The new custom data. ### Ticked Fired when the entity is ticked. - **deltaTime** (number) - The delta time since last tick. ### ModelChanged Fired when the model of the entity changes. - **newModel** (Model | BasePart?) - The new model or base part of the entity. - **oldModel** (Model | BasePart?) - The previous model or base part of the entity. ### LockChanged Fired when the native server CFrame replication lock state changes. - **isLocked** (boolean) - Whether the native server CFrame replication is locked. ``` -------------------------------- ### Entity Lifecycle and Events Source: https://parihsz.github.io/Chrono/reference/entity Methods for destroying an entity and accessing its custom events. ```APIDOC ## Destroy ### Description Destroys this entity and unregisters it from the holder. Cleans up model and snapshot data. ### Method DELETE ### Endpoint /websites/parihsz_github_io_chrono/Entity/Destroy ## GetEvent ### Description Gets a custom event for this entity by name. ### Method GET ### Endpoint /websites/parihsz_github_io_chrono/Entity/GetEvent ### Parameters #### Query Parameters - **eventName** (string) - Required - The name of the event to retrieve. ### Response #### Success Response (200) - **Event?** - The requested event, or nil if not found. ``` -------------------------------- ### Entity Replication Control (Chrono) Source: https://parihsz.github.io/Chrono/guides/npcs This snippet demonstrates how to control entity replication in the Chrono project. It covers setting replication modes for player deaths and manually pausing or resuming replication for specific entities. ```javascript const REPLICATE_DEATHS = { PLAYER_ENTITIES: "PLAYER_ENTITIES", PLAYER_CHARACTERS: "PLAYER_CHARACTERS", NATIVE: "NATIVE" }; // Example usage: // server.SetReplicateDeaths(REPLICATE_DEATHS.PLAYER_CHARACTERS); // Entity.PauseReplication(entityId); // Entity.ResumeReplication(entityId); ``` -------------------------------- ### Destroying an Entity (Chrono) Source: https://parihsz.github.io/Chrono/guides/npcs This code snippet illustrates the process of destroying an entity within the Chrono project. Calling Entity.Destroy removes the entity from the server and all clients, also cleaning up associated listeners. ```javascript // Example usage: // Entity.Destroy(entityId); ``` -------------------------------- ### Push Entity Snapshot Data Source: https://parihsz.github.io/Chrono/reference/entity Records a new snapshot of the entity's state, including its CFrame and optional velocity, at a specific time. This is crucial for replicating entity movement and state changes. ```lua local currentTime = tick() local newCFrame = CFrame.new(10, 5, 0) local newVelocity = Vector3.new(1, 0, 0) local isLatest = Entity.Push(self, currentTime, newCFrame, newVelocity) if isLatest then print("Successfully pushed the latest snapshot.") end ``` -------------------------------- ### Set Replication Rule for Entity in Chrono Source: https://parihsz.github.io/Chrono/reference/replicationrules Sets a replication rule for a specific target entity in Chrono. The rule can be a predefined struct or a custom function. If nil is provided, any existing rule for the target is removed. The target can be a Player, Model, Entity ID, or Entity object. ```lua Shared.ReplicationRules.SetReplicationRule(target, rule) ``` -------------------------------- ### Update Character Model Source: https://parihsz.github.io/Chrono/guides/migration Compares the deprecated v1 character update method with the current v2 approach using the Entity API. The v2 method retrieves the entity from the player and updates the model directly. ```Luau -- v1 Characters.SetCharacter(player, newModel) -- v2 local playerEntity = Holder.GetEntityFromPlayer(player) Entity.SetModel(playerEntity, newModel) ``` -------------------------------- ### Pause and Resume Entity Replication Source: https://parihsz.github.io/Chrono/guides/npcs Control the replication of entity updates to clients by pausing and resuming the replication process. ```APIDOC ## Pause and Resume Entity Replication ### Description Entities can have their replication updates paused or resumed using `Entity.PauseReplication` and `Entity.ResumeReplication`. Pausing stops server-to-client updates while the entity remains on both server and client. This is useful for temporary suspension of replication without destroying the entity. ### Method - `Entity.PauseReplication(entityId)` - `Entity.ResumeReplication(entityId)` ### Endpoint Not applicable (Method calls on an entity object) ### Parameters #### Path Parameters - **entityId** (string) - Required - The unique identifier of the entity. ### Request Example ```lua -- Pause replication for an entity Entity.PauseReplication("my_entity_id") -- Resume replication for an entity Entity.ResumeReplication("my_entity_id") ``` ### Response #### Success Response (200) No explicit response, operation is performed. #### Response Example Not applicable ``` -------------------------------- ### Detach Entity (Chrono) Source: https://parihsz.github.io/Chrono/guides/mounting Removes an entity from its current mount, detaching it from its parent. This function is server-only. ```Chrono Entity.ClearMount(follower) ``` -------------------------------- ### Destroying an Entity Source: https://parihsz.github.io/Chrono/guides/npcs Removes an entity from the server and all clients, cleaning up associated listeners. ```APIDOC ## Destroying an Entity ### Description Calling `Entity.Destroy` removes the entity from the server and the registry, consequently removing it from all clients. This action also cleans up any listeners connected to the entity. ### Method - `Entity.Destroy(entityId)` ### Endpoint Not applicable (Method call on an entity object) ### Parameters #### Path Parameters - **entityId** (string) - Required - The unique identifier of the entity to destroy. ### Request Example ```lua -- Destroy an entity Entity.Destroy("entity_to_remove_id") ``` ### Response #### Success Response (200) No explicit response, operation is performed. #### Response Example Not applicable ``` -------------------------------- ### Swap Entity Types for Ragdolling and Unragdolling (Lua) Source: https://parihsz.github.io/Chrono/guides/ragdolls Demonstrates how to switch an entity's type to 'PLAYER_RAGDOLL' when ragdolling and back to 'PLAYER' after the ragdoll state is disabled. This ensures the correct replication and physics settings are applied during and after the ragdoll event. ```lua Chrono.Entity.SetEntityType(entity, "PLAYER_RAGDOLL") Ragdoll.SetRagdollEnabled(character) --after ragdoll: Ragdoll.SetRagdollDisabled(character) Chrono.Entity.SetEntityType(entity, "PLAYER") ``` -------------------------------- ### Modify Ragdoll Script for Head as PrimaryPart (Lua) Source: https://parihsz.github.io/Chrono/guides/ragdolls Provides a modification to the Ragdoll script to handle scenarios where the Head is the PrimaryPart. This involves creating a second skeleton copy and managing its transparency and replication. This approach is noted as hacky but necessary if Head must remain the PrimaryPart. ```lua local function ToggleLocalTransparency(model: Model, transparency) for i, v in model:QueryDescendants("BasePart") do v = v :: BasePart if not v:HasTag("RAG_DOLL_COPY") then v.LocalTransparencyModifier = transparency end end end -- Activating ragdoll on an arbitrary model with a Humanoid: local function EnableRagdoll(model: Model) local isSelfRagdoll = RunService:IsClient() and model == Players.LocalPlayer.Character local original = model if not isSelfRagdoll then ToggleLocalTransparency(model, 1) model.Archivable = true model = model:Clone() model:RemoveTag(SHOULD_RAGDOLL_TAG) model.Archivable = false model.Name = MODEL_COPY model.Parent = original for _, limb in model:QueryDescendants("BasePart") do limb = limb :: BasePart limb:AddTag("RAG_DOLL_COPY") end task.spawn(function() local function GetPart(model) if model:FindFirstChild("HumanoidRootPart") then return model:FindFirstChild("HumanoidRootPart") elseif model.PrimaryPart then return model.PrimaryPart end return Instance.new("Part") end while model.Parent ~= nil do GetPart(model).CFrame = GetPart(original).CFrame RunService.Heartbeat:Wait() end end) end ... rest of the ragdoll script end ``` -------------------------------- ### Clear Entity State Source: https://parihsz.github.io/Chrono/reference/entity Resets the entity's snapshot data and its last cached CFrame and time. This is useful for cleaning up entity states when they are no longer needed or are being re-initialized. ```lua Entity.Clear(self) ``` -------------------------------- ### Register Custom Entity Type for Ragdolls (Lua) Source: https://parihsz.github.io/Chrono/guides/ragdolls Registers a custom entity type 'PLAYER_RAGDOLL' within the Chrono configuration. This allows for specific settings like tick rate, full rotation, and model replication mode to be applied when a player is ragdolled. This is done via a separate configuration profile. ```lua local Config = require(chrono.Shared.Config) Config.RegisterEntityType("PLAYER_RAGDOLL", { TICK_RATE = 1 / 20, FULL_ROTATION = true, MODEL_REPLICATION_MODE = "NATIVE", }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.