How to get all players in game

Also at the bottom of your script somewhere, I forgot to mention, you need to connect the function.

--some where else in the server script.
MESSAGE_SERVICE:SubscribeAsync("banUser", banSubscribeAsync)

Have you not read the OP’s replies above?

He’s most likely trying to achieve cross-server banning, so when you ban someone if they aren’t on your server, they will still be kicked and banned immediately.

I know this was 3 months ago but I stumbled across this and I thought that what you could do is for your ban system, if you know how to use profileservice then what you could do is make a profiletemplate and for example make a boolean key which is set to false automatically for normal players. Once a player does something that triggers your anticheat set it to true and on a playeradded event check if the profile.Data.BooleanKey = true and if it does you can :Kick() the player.