FindValue
CacheTable:FindValue(player, Entry)
Can be called from the Server or Client.
This function will deep loop within all the tables in the cache and fish out a Value that has the given Entry argument.
FindEntry Arguments:
player userdata value | Only for NonGlobal
Entry | the entry that will be found within a value.
Example Usage for NonGlobal:
local InventoryCache = Cache:Create("Inventory",
{DatastoreSave = true, Replicate = true},
{
["Available Slots"] = 10,
{Item = "Basic Sword",Level = 1, XP = 1},
{Item = "Apple"},
}
)
local player = game.Players.forbrad --The player object
--Get a players available slots
print(InventoryCache:FindValue(player,"Available Slots") ) -- Output: 10
Example Usage for Global:
local WinnerCache = Cache:Create("Winners",
{Global = true, Replicate = true},
{
["1stPlace"] = "forbrad",
["2ndPlace"] = "john",
["3rdPlace"] = "doe",
}
)
--Get 1stPlace player
print(WinnerCache:FindValue("1stPlace") ) -- Output: forbrad
Updated almost 2 years ago
Did this page help you?