Is there a way to ban someone when they're not in-game?

I’ve made a ban system, but it only works if the person I want to ban is in-game. I don’t want to use a table though, since that’s just messy not an efficient way to ban people. I’ve been looking for solutions everywhere, but nothing. I want to do this because I have a report channel in my Discord server, and they’d just have to get a mod to join every server until they find the-person-whose-reporting’s server.

game.Players is useful for such cases aswell, not only does it work for in-game purposes, but for out-game aswell, you could use it to get the id of any player, as well as their names. And use it to ban/unban.

A simple way would be to check when a player has joined, see if their ID is equal to the desired target, if it is, kick him.

2 Likes

how would I data store ban someone outside of the game? I mean, they’d have to play it since their data would be detected

But I want to join my game, ban people with this menu you I made, then done.

Yes, however tables are a lot more efficient to use. You could try doing a PlayerAdded function, and then check the player’s id is equivalent to the one you want to kick.

1 Like

You dont have to use data store.

A simple way would be to check when a player has joined, see if their ID is equal to the desired target, if it is, kick him.

but would that cause a lag spike if there’s like 500 people in the table? And it might make code look messy but whatever it takes

No, it wouldnt cause any lag. You can have tons of people in the list .
Tho, I dont know how you gonna have that many people in a table, never seen such cases with more than 30 players in 1 table.

1 Like

would table.find work? And would table.find be the same thing as making a for loop for it?

Yes, you could use table.find for arrays, and table["value"] for dictionaries.

1 Like

ohh thx so much I’ll be doing that. I just had bad experience with doing big for loops since I used to loop through all the building blocks in my building game and there’d be like 500 blocks… but I realized that the table would be much smaller and wouldn’t be looping through objects with a giant list of properties

I did do that, but now I know it’s the correct and most efficient method. Thanks so much