{"id":"ytrev/replion","name":"replion","scope":"ytrev","platform":"roblox","description":"A lightweight State Replicator.","version":"0.3.4","latest":"0.3.4","versions":["0.2.0","0.2.1","0.3.0","0.3.1","0.3.2","0.3.3","0.3.4"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{"evaera/promise":{"version":"^4.0.0","alias":"Promise"},"sleitnick/signal":{"version":"^1.1.0","alias":"Signal"},"freddylist/llama":{"version":"^1.1.1","alias":"llama"},"osyrisrblx/t":{"version":"^3.0.0","alias":"t"}},"integrity":"533a657a2c7e17dbe44a99f0d3e41a8ca872b1dabf22b1bce9c4ebb885fafb13","likes":0,"downloads":0,"install":"forest install ytrev/replion","url":"https://forest.dev/p/roblox/ytrev/replion","files":"https://api.forest.dev/ai/package/roblox/ytrev/replion/files","readme":"<p align=\"center\">\r\n\t<img src=\".github/logo.svg\" height=\"180\" />\r\n\t<br />\r\n\tReplion is a module that allows the replication of information from Server to Client lightly and efficiently.\r\n</p>\r\n\r\n# Installation\r\n\r\n## Wally\r\nAdd Replion as a dependency to your `wally.toml` file:\r\n```\r\nReplion = \"ytrev/replion@0.3.4\"\r\n```\r\n\r\n# Usage\r\nA simple example that shows how to use Replion.\r\n\r\n### **Server**\r\n```lua\r\nlocal ReplicatedStorage = game:GetService('ReplicatedStorage')\r\nlocal Players = game:GetService('Players')\r\n\r\nlocal ReplionService = require(ReplicatedStorage.Packages.Replion)\r\n\r\nlocal function createReplion(player: Player)\r\n\tReplionService.new({\r\n\t\tName = 'Data',\r\n\t\tPlayer = player,\r\n\t\tData = {\r\n\t\t\tCoins = 0,\r\n\t\t},\r\n\t})\r\nend\r\n\r\nPlayers.PlayerAdded:Connect(createReplion)\r\n\r\nfor _: number, player: Player in ipairs(Players:GetPlayers()) do\r\n\tcreateReplion(player)\r\nend\r\n\r\nwhile true do\r\n\tfor _: number, player: Player in ipairs(Players:GetPlayers()) do\r\n\t\tlocal playerReplion = ReplionService:GetReplion(player, 'Data')\r\n\t\tif playerReplion then\r\n\t\t\tplayerReplion:Increase('Coins', 10)\r\n\t\tend\r\n\tend\r\n\r\n\ttask.wait(1)\r\nend\r\n```\r\n\r\n### **Client**\r\n```lua\r\nlocal ReplicatedStorage = game:GetService('ReplicatedStorage')\r\n\r\nlocal ReplionController = require(ReplicatedStorage.Packages.Replion)\r\n\r\nReplionController:AwaitReplion('Data')\r\n\t:andThen(function(clientReplion)\r\n\t\tclientReplion:OnUpdate('Coins', function(action, _path, newValue)\r\n\t\t\tprint(string.format('Coins %s to %i', action.Name, newValue))\r\n\t\tend)\r\n\tend)\r\n\t:catch(warn)\r\n\r\nReplionController.Start()\r\n```","readmeTruncated":false}