PipeObject
CacheTable:PipeObject(if non Global and Server player, Entry, Object, Property)
This will update the Object of Arg Object. OnUpdate sets Arg Property to Entry Value in cache.
PipeObject Arguments:
player userdata value | Only for NonGlobal
Entry | the entry that will be found within a value.
Object | The object will be changed
Property | The property that will be set to the Entry Value of the cache on update (Ex: Text, Value)
Server Usage:
Example Usage for NonGlobal:
local PlayerStatsCache = Cache:Create("PlayerStats", { Replicate = true}, {Coins = 7})
InventoryCache:PlayerAdded(function(player, NewCache)
StatsCache:PipeObject(player, "Coins", game.Workspace.CoinsList[player.Name], "Text")
end)
Example Usage for Global:
local StatsCache = Cache:Create("Stats", {Global = true, Replicate = true}, {HighestCoins = 7})
StatsCache:PipeObject("HighestCoins", game.Workspace.HighestCoins, "Value")
Client Usage
Example Usage for NonGlobal:
local PlayerStats = Cache:GetCache("PlayerStats")
local PlrGui = game.Players.LocalPlayer.PlayerGui
local CoinsLabel = PlrGui.StatsGui.Coins
PlayerStats:PipeObject("Coins", CoinsLabel, "Text" )
Example Usage for Global:
local Stats = Cache:GetCache("Stats")
local PlrGui = game.Players.LocalPlayer.PlayerGui
local TopCoinsLabel = PlrGui.StatsGui.TopCoins
Stats:PipeObject("HighestCoins", TopCoinsLabel, "Text" )
Updated almost 2 years ago