### Install Replion via Wally Source: https://github.com/ytrev/replion/blob/master/README.md Add the Replion dependency to your wally.toml configuration file to include the module in your Roblox project. ```toml Replion = "ytrev/replion@2.0.1" ``` -------------------------------- ### ServerReplion:Get - Get Value at Path Source: https://context7.com/ytrev/replion/llms.txt Retrieves the value at the specified path. Returns nil if the path doesn't exist. ```APIDOC ## ServerReplion:Get - Get Value at Path ### Description Retrieves the value at the specified path. Returns nil if the path doesn't exist. ### Method `ServerReplion:Get(path)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Coins = 100, Inventory = { Weapons = { 'Sword', 'Bow' } } } }) -- Get simple value local coins = playerData:Get('Coins') print('Coins:', coins) --> 100 -- Get nested value with array path local weapons = playerData:Get({ 'Inventory', 'Weapons' }) print('Weapons:', table.concat(weapons, ', ')) --> Sword, Bow -- Get non-existent value returns nil local gems = playerData:Get('Gems') print('Gems:', gems) --> nil ``` ### Response #### Success Response (200) - **value** (any) - The value found at the specified path, or nil if the path does not exist. #### Response Example ```lua -- Returns the value at the path, or nil ``` ``` -------------------------------- ### Implement Server-Client Data Synchronization with Replion Source: https://context7.com/ytrev/replion/llms.txt This example demonstrates how to initialize server-side player data using Replion and consume it on the client. It covers data structure definition, reactive change listeners, and array manipulation for inventory systems. ```lua -- Server Script local Players = game:GetService('Players') local Replion = require(path.to.replion) type PlayerData = { Coins: number, Level: number, Experience: number, Items: { string }, Stats: { Health: number, MaxHealth: number, } } type PlayerReplion = Replion.ServerReplion local function createPlayerData(player: Player) local replion: PlayerReplion = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Tags = { 'player', 'saveable' }, Data = { Coins = 100, Level = 1, Experience = 0, Items = {}, Stats = { Health = 100, MaxHealth = 100 } } }) replion:OnChange('Level', function(newLevel, oldLevel) print(player.Name, 'reached level', newLevel) end) return replion end for _, player in Players:GetPlayers() do task.spawn(createPlayerData, player) end Players.PlayerAdded:Connect(createPlayerData) local function giveReward(player: Player, coins: number, item: string?) local playerData = Replion.Server:GetReplionFor(player, 'PlayerData') if not playerData then return end playerData:Increase('Coins', coins) if item then playerData:Insert('Items', item) end end -- Client LocalScript local Replion = require(path.to.replion) Replion.Client:AwaitReplion('PlayerData', function(playerData) local coins = playerData:Get('Coins') local level = playerData:Get('Level') coinsLabel.Text = tostring(coins) levelLabel.Text = 'Level ' .. level playerData:OnChange('Coins', function(newCoins) coinsLabel.Text = tostring(newCoins) end) playerData:OnChange('Level', function(newLevel) levelLabel.Text = 'Level ' .. newLevel end) playerData:OnArrayInsert('Items', function(index, item) addItemToInventory(item) end) playerData:OnArrayRemove('Items', function(index, item) removeItemFromInventory(item, index) end) end) ``` -------------------------------- ### ServerReplion:GetExpect - Get Value with Error on Missing Source: https://context7.com/ytrev/replion/llms.txt Same as Get, but throws an error if the value doesn't exist. Useful for required values. ```APIDOC ## ServerReplion:GetExpect - Get Value with Error on Missing ### Description Same as Get, but throws an error if the value doesn't exist. Useful for required values. ### Method `ServerReplion:GetExpect(path, errorMessage)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Coins = 100 } }) -- Will error if path doesn't exist local coins = playerData:GetExpect('Coins') -- Custom error message local gems = playerData:GetExpect('Gems', 'Player must have gems!') -- Error: Player must have gems! ``` ### Response #### Success Response (200) - **value** (any) - The value found at the specified path. #### Error Response - **Error** - Throws an error if the specified path does not exist. #### Response Example ```lua -- Returns the value at the path, or throws an error if not found. ``` ``` -------------------------------- ### Get All Replions for a Player (Lua) Source: https://context7.com/ytrev/replion/llms.txt Returns a list of all Replion instances that are currently being replicated to a specific player. This includes Replions targeted specifically at the player and those set to replicate to 'All' clients. ```lua local Replion = require(path.to.replion) local player = game.Players:GetPlayers()[1] local playerReplions = Replion.Server:GetReplionsFor(player) for _, replion in playerReplions do print('Channel:', replion.Channel) print('Data:', replion.Data) end ``` -------------------------------- ### Retrieve Replion Data (Lua) Source: https://context7.com/ytrev/replion/llms.txt Methods to access data stored within a Replion instance. Get returns nil if missing, while GetExpect throws an error if the path is not found. ```lua local coins = playerData:Get('Coins') -- Get with error handling local gems = playerData:GetExpect('Gems', 'Player must have gems!') ``` -------------------------------- ### Get Player-Specific Replion by Channel (Lua) Source: https://context7.com/ytrev/replion/llms.txt Retrieves a Replion instance that is specifically replicated to a given player, identified by its channel name. This is useful when multiple Replions share a channel but target different players. ```lua local Replion = require(path.to.replion) local player = game.Players:GetPlayers()[1] local playerData = Replion.Server:GetReplionFor(player, 'PlayerData') if playerData then local coins = playerData:Get('Coins') print(player.Name, 'has', coins, 'coins') end ``` -------------------------------- ### Get Replion by Channel Name (Lua) Source: https://context7.com/ytrev/replion/llms.txt Retrieves a global Replion instance using its unique channel name. This function will throw an error if multiple Replions exist with the same channel. It's intended for retrieving single, globally accessible Replions. ```lua local Replion = require(path.to.replion) -- Get a global replion (only one exists with this channel) local gameState = Replion.Server:GetReplion('GameState') if gameState then print('Current map:', gameState:Get('CurrentMap')) end ``` -------------------------------- ### Implement Server-Side Data Replication Source: https://github.com/ytrev/replion/blob/master/README.md Initialize a ServerReplion instance to manage data for specific players. This snippet demonstrates creating a channel, setting initial data, and updating values over time. ```lua local Players = game:GetService('Players') local Replion = require(path.to.replion) type DataReplion = Replion.ServerReplion<{ Coins: number, }> local function createReplion(player: Player) Replion.Server.new({ Channel = 'Data', ReplicateTo = player, Data = { Coins = 0, } }) end Players.PlayerAdded:Connect(createReplion) for _, player: Player in Players:GetPlayers() do task.spawn(createReplion, player) end while true do for _, player: Player in Players:GetPlayers() do local playerReplion: DataReplion? = Replion.Server:GetReplionFor(player, 'Data') if not playerReplion then continue end playerReplion:Increase('Coins', 10) end task.wait(1) end ``` -------------------------------- ### Create New Server Replion Instance (Lua) Source: https://context7.com/ytrev/replion/llms.txt Creates a new ServerReplion instance for replicating data. It can be player-specific, for a group, or for all players. Data is structured and can include optional tags and replication settings. ```lua local Replion = require(path.to.replion) -- Create a player-specific replion local playerReplion = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, -- Player | { Player } | 'All' Data = { Coins = 100, Level = 1, Items = { 'Sword', 'Shield' }, Stats = { Health = 100, Mana = 50 } }, Tags = { 'player', 'saveable' }, -- Optional tags for filtering DisableAutoDestroy = false -- Optional: prevent auto-destroy when player leaves }) -- Create a replion for all players local globalReplion = Replion.Server.new({ Channel = 'GameState', ReplicateTo = 'All', Data = { RoundTime = 300, CurrentMap = 'Desert' } }) ``` -------------------------------- ### Listen for Replion Creation on Client Source: https://context7.com/ytrev/replion/llms.txt Global signals to detect when any new Replion is received from the server, optionally filtered by tags. ```lua local Replion = require(path.to.replion) -- Listen for any Replion.Client:OnReplionAdded(function(replion) print('Received:', replion._channel) end) -- Listen for tagged Replion.Client:OnReplionAddedWithTag('ui', function(replion) print('UI replion received') end) ``` -------------------------------- ### Retrieve Replion Instances on Client Source: https://context7.com/ytrev/replion/llms.txt Methods to access Replion instances on the client, including synchronous retrieval, yielding until arrival, and asynchronous callbacks. ```lua local Replion = require(path.to.replion) -- Synchronous get local playerData = Replion.Client:GetReplion('PlayerData') -- Yielding wait local gameState = Replion.Client:WaitReplion('GameState', 10) -- Async callback local cancel = Replion.Client:AwaitReplion('PlayerData', function(data) print('Received!') end, 30) ``` -------------------------------- ### ServerReplion:Set - Set Value at Path Source: https://context7.com/ytrev/replion/llms.txt Sets a value at the specified path and replicates the change to clients. Returns the new value. ```APIDOC ## ServerReplion:Set - Set Value at Path ### Description Sets a value at the specified path and replicates the change to clients. Returns the new value. ### Method `ServerReplion:Set(path, value)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Coins = 0 } }) -- Set a simple value local newCoins = playerData:Set('Coins', 500) print('Coins set to:', newCoins) --> 500 -- Set a nested value using path array playerData:Set({ 'Profile', 'Avatar' }, 'warrior') -- Set a nested value using dot notation playerData:Set('Profile.Name', 'Hero') ``` ### Response #### Success Response (200) - **newValue** (any) - The value that was set at the specified path. #### Response Example ```lua -- Returns the new value set ``` ``` -------------------------------- ### Server:OnReplionAdded - Listen for Replion Creation Source: https://context7.com/ytrev/replion/llms.txt Connects to a signal that fires whenever any new Replion is created on the server. ```APIDOC ## Server:OnReplionAdded - Listen for Replion Creation ### Description Connects to a signal that fires whenever any new Replion is created on the server. ### Method `Server:OnReplionAdded(callback)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua local Replion = require(path.to.replion) local connection = Replion.Server:OnReplionAdded(function(channel, replion) print('New replion created:', channel) end) -- Disconnect when no longer needed connection:Disconnect() ``` ### Response #### Success Response (Callback fires on Replion creation) - **channel** (string) - The channel of the newly created Replion. - **replion** (object) - The newly created Replion instance. #### Response Example ```lua -- Callback function is executed with channel and replion arguments ``` ``` -------------------------------- ### Listen for Array Insertions with ServerReplion Source: https://context7.com/ytrev/replion/llms.txt Connects to a signal that triggers when a value is inserted into an array at a specific path. This is useful for tracking dynamic lists like inventory or item collections. ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Items = {} } }) playerData:OnArrayInsert('Items', function(index, value) print('Item inserted at index', index, ':', value) end) playerData:Insert('Items', 'Sword') --> Item inserted at index 1 : Sword playerData:Insert('Items', 'Bow', 1) --> Item inserted at index 1 : Bow ``` -------------------------------- ### Handle Array Operations and Lifecycle Source: https://context7.com/ytrev/replion/llms.txt Methods to track array insertions, removals, and perform cleanup tasks before a ClientReplion instance is destroyed. ```lua Replion.Client:AwaitReplion('PlayerData', function(playerData) -- Array events playerData:OnArrayInsert('Items', function(index, item) print('Added:', item) end) playerData:OnArrayRemove('Items', function(index, item) print('Removed:', item) end) -- Lifecycle cleanup playerData:BeforeDestroy(function() print('Cleaning up UI...') end) end) ``` -------------------------------- ### Listen for Replion Lifecycle Events (Lua) Source: https://context7.com/ytrev/replion/llms.txt Connects to global signals that fire when any Replion is created or destroyed on the server. These methods return connection objects for cleanup. ```lua local Replion = require(path.to.replion) -- Listen for creation local connection = Replion.Server:OnReplionAdded(function(channel, replion) print('New replion created:', channel) end) -- Listen for destruction Replion.Server:OnReplionRemoved(function(channel, replion) print('Replion destroyed:', channel) end) ``` -------------------------------- ### Server:AwaitReplionFor - Async Callback for Player-Specific Replion Source: https://context7.com/ytrev/replion/llms.txt Registers a callback for when a player-specific Replion is created. The callback only fires if the Replion is replicated to the specified player. ```APIDOC ## Server:AwaitReplionFor - Async Callback for Player-Specific Replion ### Description Registers a callback for when a player-specific Replion is created. The callback only fires if the Replion is replicated to the specified player. ### Method `Server:AwaitReplionFor(player, channel, callback, timeout)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua local Replion = require(path.to.replion) local function setupPlayer(player) Replion.Server:AwaitReplionFor(player, 'PlayerData', function(playerData) print(player.Name, 'data initialized') end, 30) -- Optional 30-second timeout end game.Players.PlayerAdded:Connect(setupPlayer) ``` ### Response #### Success Response (Callback fires when player-specific Replion is created and replicated) - **playerData** (object) - The created player-specific Replion instance. #### Response Example ```lua -- Callback function is executed with the playerData object ``` ``` -------------------------------- ### Await Replion Creation (Lua) Source: https://context7.com/ytrev/replion/llms.txt Registers a callback that executes when a Replion with a specific channel is created. It supports an optional timeout and returns a cancellation function to stop the wait process. ```lua local Replion = require(path.to.replion) -- Non-blocking wait with callback local cancel = Replion.Server:AwaitReplion('GameState', function(gameState) print('Game state created!') gameState:OnChange('RoundTime', function(newTime) print('Round time updated:', newTime) end) end, 60) -- Optional 60-second timeout -- Cancel the wait if needed task.delay(10, function() if cancel then cancel() print('Stopped waiting for GameState') end end) ``` -------------------------------- ### Server:AwaitReplion - Async Callback for Replion Creation Source: https://context7.com/ytrev/replion/llms.txt Registers a callback that fires when a Replion with the specified channel is created. Returns a cancel function to stop waiting. ```APIDOC ## Server:AwaitReplion - Async Callback for Replion Creation ### Description Registers a callback that fires when a Replion with the specified channel is created. Returns a cancel function to stop waiting. ### Method `Server:AwaitReplion(channel, callback, timeout)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua local Replion = require(path.to.replion) local cancel = Replion.Server:AwaitReplion('GameState', function(gameState) print('Game state created!') end, 60) -- Optional 60-second timeout -- Cancel the wait if needed task.delay(10, function() if cancel then cancel() print('Stopped waiting for GameState') end end) ``` ### Response #### Success Response (Callback fires when Replion is created) - **gameState** (object) - The created Replion instance. #### Response Example ```lua -- Callback function is executed with the gameState object ``` ``` -------------------------------- ### Handle Lifecycle with BeforeDestroy and Destroy Source: https://context7.com/ytrev/replion/llms.txt Manages the cleanup of a Replion instance. BeforeDestroy allows for final data saving, while Destroy disconnects signals and notifies clients to remove local copies. ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Coins = 100 } }) playerData:BeforeDestroy(function() print('Saving player data before destruction...') end) playerData:Destroy() ``` -------------------------------- ### Await Player-Specific Replion (Lua) Source: https://context7.com/ytrev/replion/llms.txt Registers a callback that triggers when a Replion is created and specifically replicated to a target player. This is useful for initializing player-specific data structures. ```lua local Replion = require(path.to.replion) local function setupPlayer(player) Replion.Server:AwaitReplionFor(player, 'PlayerData', function(playerData) print(player.Name, 'data initialized') -- Setup listeners for this player's data playerData:OnChange('Level', function(newLevel, oldLevel) print(player.Name, 'leveled up from', oldLevel, 'to', newLevel) end) end, 30) end game.Players.PlayerAdded:Connect(setupPlayer) ``` -------------------------------- ### Search and Observe Data Changes Source: https://context7.com/ytrev/replion/llms.txt Provides functionality to search arrays and subscribe to data modifications. Supports granular path-based listeners and general data change events. ```lua Replion.Client:AwaitReplion('PlayerData', function(playerData) -- Find value in array local index, value = playerData:Find('Items', 'Sword') -- Listen for specific path changes playerData:OnChange('Coins', function(newCoins, oldCoins) print('Coins updated:', newCoins) end) -- Listen for any data change playerData:OnDataChange(function(newData, changedPath) print('Data updated at:', table.concat(changedPath, '.')) end) end) ``` -------------------------------- ### Listen for Array Removals with ServerReplion Source: https://context7.com/ytrev/replion/llms.txt Connects to a signal that triggers when a value is removed from an array at a specific path. It provides the index and the removed value as arguments. ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Items = { 'Sword', 'Shield' } } }) playerData:OnArrayRemove('Items', function(index, value) print('Item removed from index', index, ':', value) end) playerData:Remove('Items') --> Item removed from index 2 : Shield ``` -------------------------------- ### Manage Replication Targets with SetReplicateTo Source: https://context7.com/ytrev/replion/llms.txt Updates the list of players who receive replication updates for a specific Replion instance. It supports single players, arrays of players, or the 'All' keyword. ```lua local Replion = require(path.to.replion) local teamData = Replion.Server.new({ Channel = 'TeamData', ReplicateTo = { player1 }, Data = { Score = 0 } }) teamData:SetReplicateTo({ player1, player2 }) teamData:SetReplicateTo('All') teamData:SetReplicateTo(player1) ``` -------------------------------- ### Consume Replicated Data on Client Source: https://github.com/ytrev/replion/blob/master/README.md Use the Client API to await a specific replication channel and listen for data changes. This allows the client to react to server-side updates in real-time. ```lua local Replion = require(path.to.replion) Replion.Client:AwaitReplion('Data', function(dataReplion) print('Coins:', dataReplion:Get('Coins')) local connection = dataReplion:OnChange('Coins', function(newCoins: number, oldCoins: number) print('Coins:', newCoins) end) end) ``` -------------------------------- ### Listen for Replion Destruction Source: https://context7.com/ytrev/replion/llms.txt Connects to signals that trigger when a Replion instance is removed from the server. Useful for cleaning up local UI components or state associated with the destroyed object. ```lua local Replion = require(path.to.replion) -- Listen for any removal Replion.Client:OnReplionRemoved(function(replion) print('Replion removed:', replion._channel) end) -- Listen for tagged removal Replion.Client:OnReplionRemovedWithTag('temporary', function(replion) print('Temporary replion removed:', replion._channel) end) ``` -------------------------------- ### Set and Update Replion Data (Lua) Source: https://context7.com/ytrev/replion/llms.txt Methods for modifying replicated data. Set updates a specific path, while Update allows batch modifications and key removal using Replion.None. ```lua local playerData = Replion.Server.new({ Channel = 'PlayerData', Data = { Coins = 0 } }) -- Set value playerData:Set('Coins', 500) -- Batch update playerData:Update('Items', { Bow = true, Shield = Replion.None }) ``` -------------------------------- ### Retrieve Data from Replion Source: https://context7.com/ytrev/replion/llms.txt Methods to access replicated data values by path. Includes standard retrieval and strict retrieval that throws errors if data is missing. ```lua Replion.Client:AwaitReplion('PlayerData', function(playerData) -- Standard get local coins = playerData:Get('Coins') -- Strict get local level = playerData:GetExpect('Level', 'Level data is required!') end) ``` -------------------------------- ### Wait for Replion Creation (Lua) Source: https://context7.com/ytrev/replion/llms.txt Yields the current thread until a Replion with the specified channel name is created. An optional timeout in seconds can be provided to prevent indefinite waiting. ```lua local Replion = require(path.to.replion) -- Wait indefinitely for the replion local gameState = Replion.Server:WaitReplion('GameState') print('Game state loaded:', gameState:Get('CurrentMap')) -- Wait with a 10-second timeout local settings = Replion.Server:WaitReplion('Settings', 10) if settings then print('Settings loaded') else print('Timeout: Settings not created within 10 seconds') end ``` -------------------------------- ### Server:OnReplionRemoved - Listen for Replion Destruction Source: https://context7.com/ytrev/replion/llms.txt Connects to a signal that fires whenever a Replion is destroyed on the server. ```APIDOC ## Server:OnReplionRemoved - Listen for Replion Destruction ### Description Connects to a signal that fires whenever a Replion is destroyed on the server. ### Method `Server:OnReplionRemoved(callback)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua local Replion = require(path.to.replion) Replion.Server:OnReplionRemoved(function(channel, replion) print('Replion destroyed:', channel) end) ``` ### Response #### Success Response (Callback fires on Replion destruction) - **channel** (string) - The channel of the destroyed Replion. - **replion** (object) - The destroyed Replion instance. #### Response Example ```lua -- Callback function is executed with channel and replion arguments ``` ``` -------------------------------- ### Wait for Player-Specific Replion Creation (Lua) Source: https://context7.com/ytrev/replion/llms.txt Yields the current thread until a Replion for a specific player and channel is created. If the player leaves the game before the Replion is created, this function returns nil. ```lua local Replion = require(path.to.replion) local function onPlayerAdded(player) -- Wait for this player's data replion (with 30s timeout) local playerData = Replion.Server:WaitReplionFor(player, 'PlayerData', 30) if playerData then print(player.Name, 'data is ready') playerData:Set('JoinTime', os.time()) end end game.Players.PlayerAdded:Connect(onPlayerAdded) ``` -------------------------------- ### ServerReplion:Update - Update Multiple Values Source: https://context7.com/ytrev/replion/llms.txt Updates multiple values at once, only sending changed values to the client. Use `Replion.None` to remove keys. ```APIDOC ## ServerReplion:Update - Update Multiple Values ### Description Updates multiple values at once, only sending changed values to the client. Use `Replion.None` to remove keys. ### Method `ServerReplion:Update(path, changes)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Items = { Sword = true, Shield = true }, Stats = { Health = 100, Mana = 50 } } }) -- Update multiple keys in a nested table playerData:Update('Items', { Bow = true, -- Add new item Shield = Replion.None -- Remove existing item }) -- Update root-level data playerData:Update({ Level = 5, Experience = 1000 }) ``` ### Response #### Success Response (200) No direct return value, but the Replion data is updated and replicated. #### Response Example ```lua -- No return value, updates are applied directly to the Replion instance. ``` ``` -------------------------------- ### Data Change Observation in Replion Source: https://context7.com/ytrev/replion/llms.txt Event-driven methods to listen for specific path updates or global data changes. These return connection objects that can be disconnected to prevent memory leaks. ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Coins = 0 } }) -- Listen for specific path change local connection = playerData:OnChange('Coins', function(new, old) print('Changed from', old, 'to', new) end) -- Listen for any data change playerData:OnDataChange(function(newData, path) print('Data changed at:', table.concat(path, '.')) end) ``` -------------------------------- ### Array Manipulation Methods in Replion Source: https://context7.com/ytrev/replion/llms.txt Provides functionality to insert, remove, clear, and search for elements within arrays stored in the data state. These methods support both top-level and nested array paths. ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Items = { 'Sword', 'Shield', 'Bow' } } }) -- Insert playerData:Insert('Items', 'Diamond Sword', 1) -- Remove local removedItem = playerData:Remove('Items', 1) -- Find local index, value = playerData:Find('Items', 'Shield') -- Clear playerData:Clear('Items') ``` -------------------------------- ### Increase and Decrease Numeric Values in Replion Source: https://context7.com/ytrev/replion/llms.txt Methods to perform atomic arithmetic operations on numeric data stored within a Replion instance. These functions accept a path to the target value and the amount to modify, returning the updated value. ```lua local Replion = require(path.to.replion) local playerData = Replion.Server.new({ Channel = 'PlayerData', ReplicateTo = player, Data = { Coins = 100, Stats = { Experience = 0 }, Health = 100 } }) -- Increase local newCoins = playerData:Increase('Coins', 50) local newExp = playerData:Increase({ 'Stats', 'Experience' }, 100) -- Decrease local newHealth = playerData:Decrease('Health', 25) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.