So, I am trying to make a system similar to a global leaderboard, but the same listing can be contributed to by anyone across any server. For example, imagine a part being clicked on. if one player clicks on this part in one server, it should add one to the tally of how many times this part has been clicked on everywhere, and everyone should see the change. this could be done with messaging service, but I want this part click count to save.
it does not have to be instant, maybe updating on 5 minute intervals, but the problem that is catching me is that how would each server coordinate exactly how many new times it was clicked in that 5 minute interval?
i mentioned messaging service in my post and said that it would not work
Each instance will have the responsibility of tracking how many times the click occurred while the update interval hasn’t been reached yet. When it’s time to update, the current instance will push the click number it tracked with UpdateAsync. In UpdateAsync you will transform the current value.
You can use UpdateAsync as both a give-and-take kind of thing. After UpdateAsync finishes you can use the value that it returns as the number of times the click has occurred. This would not constitute an exact sync but it will rid you of update collisions.
local clicks = ClickStore:UpdateAsync(click_key, function(current, keyInfo)
local userIds = keyInfo:GetUserIds()
local metadata = keyInfo:GetMetadata()
local value = if current then current else 0
value += serverClicksMade -- Set serverClicksMade to 0
return value, userIds, metadata
If you wanted an approximate exact sync, you could incorporate DateTime to develop a system where regardless of when the instance spins up, it will always perform its update/fetch at the same time interval as other servers (every XX:05 for example).
this is what i needed, thanks!