Hello. I’m trying to make some sort of thing where players can register in a team and then contribute to their team by killing enemies. Throughout servers, the team’s kills will save.
Say one team has 20 kills and the other has 15. Somebody decides to register into the losing team to try and help them out, and they farm 20 kills. Now the other team is permanently winning with a 35 kill-lead.
I also want this to display on a leaderboard, so I can give the winning team rewards after a week or two.
Is there any way to make this consistently? I’ve been looking at MemoryStoreService and DataStoreService but I am curious to see if there’s a better way to do it.
I would give each team a unique ID and store it in DataStoreService. You could also save the number of teams, assign each new team to that number plus one, and then increment that number. This would probably be one of the most simple methods. You can have an owner attribute as well as a list of registered players, and any other metadata required.
Quite interesting. I believe it involves both DataStore for players, and OrderedDataStore/GlobalDataStore for leaderboard interactions
In each individual datastore for players, assert their team, everytime on a kill (or tallying them up and making a queue system to update at end of round to avoid overloading:) update/increment the leaderboard using teamindex and total kill value.
I find clans alot more difficult to imagine doing (i.e. making a clan and obtaining the list of players), perhaps there would be a datastore for clans themselves and you’d use the clan name or id as a identifier when fetching datastore but Im not sure if this is possible?
Late reply, but would a single DataStore cause any sort of overlap? Like some players get a kill at the same time, so the :GetAsync() would be a little bit off? I did consider using DataStoreService but I was concerned with how performant that would be.
To fix an issue like that, you could maybe have a different datastore for each team or something. That way, you can use each player’s UserId as the key and not have to worry about data merge conflicts. You could then add up all the kills of players somehow, many different ways to do it.
Got it working, made a system using DataStoreService, and then :UpdateAsync() each time the player inside the clan left and used that to apply the data across servers.