If this uses DataStoreService, I suggest you change it to ProfileService.
If this is used in a popular game (ex. 200+ concurrent players) and uses Robloxās default DSS, ban data for some users could get reset and theyād be unbanned.
Iām sorry but just regular DataStoreService hasnāt let me down yet, even for some games Iāve worked on that had 10k+ concurrent users. Thanks for the suggestion though, but I donāt have the time to implement it right now.
ProfileService still uses normal datastores. the point of that module was for session locking. there will not be data loss with the average datastore esprcially with banning.
Maybe add a setting within the module to allow the module to kick any users if their data fails to load? If theyāre banned and their data doesnāt load, then theyāll be allowed to join the game. Itās not too likely to happen, but sometimes outages occur.
Added ProfileService to the module, if there are any bugs, please inform me quickly so I can fix them
If you already have ProfileService in your game, make sure to delete the one under BanManager and reference the already existing ProfileService in the BanManagerās main script
Iāll also start adding the version number in the BanManagerās name so itās easier to differentiate the versions when I can
(@benpinpop The module should now kick players if their data does not load correctly in order to prevent people who have been banned joining when they shouldnāt)
This is a really interesting module but you should add two things:
the agility to have a custom kick handler, this could be implemented using BanManager:SetKickHandler(handler: (player, banData)->()), which would be really useful to add additional informations to the kick message or even teleport player to a game instead of kicking him
the ability to use custom datastore service with BanManager:SetDataHandler(getUserData:(userid: number)->any, setUserData: (userid: number, data: any)->(success: boolean)) it would be useful for develeopers who use their own systems or even external database
This is just for basic uses for newer people who donāt know/have the time to make a ban system.
Adding a custom data handler for people to use would overcomplicate things for the average user and if you are going to do that, you might as well make it yourself since you have the know how of making a ban system.
I might add that one day but if you want that functionality right now, you can go ahead and edit the source codeās Ban function.
That GetBansData was a needed addition. Iāve been using this resource for a long time, and i had to make up my own hacky solution with datastore to achieve that.
Also what are the limits for this? How many bans would it take to break a datastore limit?
Also are you sure the kick method is the best way of solving the failing to load issue?
.GetBanDatas by default returns every key available. Thereās a limit parameter you can add which I would personally use.
Roblox datastores can store (virtually) infinite keys Iām fairly sure, so you donāt have to worry about not having enough storage to ban millions of people.
The only thing that Roblox does limit though is the value in each key, so as long as you donāt cram a ton of data in ExtraData, you will be good.
I would say it is, as for me itās better to kick out an innocent player than let an exploiter in your game wreck havoc.
If you have any suggestions for that though, Iām open to hearing it.
Edit: Now that Iām thinking about it, I could try teleporting them back to the game if it fails, would that be a good idea?
Thank you very much! Your CanvasDraw module was also very helpful for some of my projects, and to be honest, I was happily surprised when you commented.
It seems to be kicking me as soon as I require the module. I think itās because LoadBanData() is returning nil even though it passed through the if success statement?? Am I doing something wrong?