Hi, I’m making a game called ‘Which Door Is Right’ and if you choose the wrong door you get permanently banned but all tutorials only tell you how to kick someone with a part. So please can someone help with a permenent ban script please
You can add the player to a table of banned players. When a player joins, check if they are in the banned table. If they are, then kick them. This way, they’re not able to play at all.
You would have to use DataStore to store the player’s id so you can kick them if they rejoin.
Heres a little script
local DataStore = game:GetService('DataStore') -- get the service
local BanStore = DataStore:GetDataStore('Bans') -- gets the store where we will log our bans
local part = -- define the ban part that when touched will ban them
part.Touched:Connect(function(hit) -- when the part is touched fire a function to log and kick the player
local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- check if the touched was the player
if player then -- checks if the player is valid
BanStore:SetAsync(player.UserId, true) -- logs the player inside the ban store
player:Kick('Banned') -- kick the player
end
end)
game.Players.PlayerAdded:Connect(function(player) -- when a player joins
local isBanned = BanStore:GetAsync(player.UserId) -- get the info from the datastore
if isBanned then -- if the player is banned
player:Kick('Banned') -- kick the player
end
end)
Sorry i dont mean that i need a ban brick instead