-- If we lookup a 'Name' using the same 'UserId', the 'Name' will come -- from cache (fast) instead of GetNameFromUserIdAsync() (yields). local cache = {} function getNameFromUserId(userId) -- First, check if the cache contains 'userId' local nameFromCache = cache[user...
-- If we lookup a 'Name' using the same 'UserId', the 'Name' will come -- from cache (fast) instead of GetNameFromUserIdAsync() (yields). local cache = {} function getNameFromUserId(userId) -- First, check if the cache contains 'userId' local nameFromCache = cache[user...
Get Name from UserId using a cache local Players = game:GetService("Players") -- Create a table called 'cache' to store each 'Name' as they are found. -- If we lookup a 'Name' using the same 'UserId', the 'Name' will come -- from cache (fast) instead of GetNameFromUser...