Ad
Log in to vote
0

How would I make this ban system work correctly?

Asked by 10 days ago

So I've made a server ban system, and before everyone mentions it, I know this is not the best way to make a ban system, but In this case this is how i wanted to do it, so...

how the ban system works is:

The ban command kicks the desired player, and to prevent them from joining that server again, It creates a BoolValue with the exact kicked player's name inside a folder.

Meanwhile a server script constantly checks for players that join using the PlayerAdded event.

I tried to make it check if the player that just joined matches name with any of the Values inside that folder, it went terribly, and instead it just kicked any player that joined, no matter they name.

How could I make this work?

How do I check If the player that joins matches name with any of the values in the folder?

0
Is the folder saved? Kingu_Criminal 120 — 10d
0
No, it's a server ban, using the ban command kicks and makes the BoolValue, in the server you're in. SharkRayMaster 81 — 9d
0
Please post your code. We won't be able to help you to our best if we can't see what you did. Xyternal 247 — 9d
0
I mean all is needed is just to check if a text matches with a name of any of the objects in a folder, anyway, the code is literally in the answer below. SharkRayMaster 81 — 8d

1 answer

Log in to vote
0
Answered by 9 days ago

Nevermind, I figured it out myself, the following script seems to have worked:

local Bans = game.ServerStorage.BanList

function BanCheck(player)
    local user = player.Name
    if Bans:FindFirstChild(user) then
        player:Kick("You're banned from this server")
    end
end

game.Players.PlayerAdded:Connect(BanCheck)
0
But you said the boolvalue is only created in the server YOU are in. I would not use this as if the player simply switches servers, they would be able to join. If you want me to provide a datastore script, I can. Kingu_Criminal 120 — 6d
Ad

Answer this question