Help with DataStore?
So I'm trying to make a cross-server chat, and I've only just recently gotten into using data store. So, I've created this exmaple of how i could possibly make one, and i tested it. It sorta works, however the more messages there are, the longer it seemingly takes to cache and load information.
01 | local Players = game:GetService( "Players" ) |
02 | local DataStoreService = game:GetService( "DataStoreService" ) |
03 | local ChatStore = DataStoreService:GetDataStore( "ChatStore" ) |
05 | Players.PlayerAdded:connect( function (p) |
06 | p.Chatted:connect( function (msg) |
07 | ChatStore:UpdateAsync( "Chats" , function (value) |
08 | table.insert(value, p.Name.. ': ' ..msg) |
15 | table.foreach(ChatStore:GetAsync( "Chats" ), print ) |
As you could imagine, that's super problematic when making a chat system. And i have seen cross-server chat systems before that operate at a faster pace, so if anyone knows how i can make this effective or usable, i'd appreciate it. Thanks.