So I made an anti-exploit and when you get banned you couldn’t join the game (it will keep kicking you), but for some reason when a banned player joins he/she doesn’t get kicked again.
Ban function
function banPlayer(player)
local playerId = player.UserId
local success, errormessage = pcall(function()
banDataStore:SetAsync(playerId, true)
end)
if success then
print(player.Name.. " has been permanently banned!")
end
player:Kick("You are banned for exploiting!")
end
Script for when they rejoin
local DataStoreService = game:GetService("DataStoreService")
local banDataStore = DataStoreService:GetDataStore("BannedPeople")
game.Players.PlayerAdded:Connect(function(plr)
local playerId = plr.UserId
local banned
local success, errormessage = pcall(function()
banned = banDataStore(playerId)
end)
if banned == true then
plr:Kick("You are banned for exploiting!")
end
end)
It successfully kick the player the first time, but they can rejoin…
Then u could say in a server script game.replicatedstorage.remoteevent.OnserverEvent:Connect(function(PlrToBan)
if IsBannedValue == true then
Plr[PlrToBan]:Kick()
end
end)
Well, have u tried using value’s like an anti-exploit value and whenever for example a players walkspeed is changed to 60 then it will be true and in the script u could say if anti-exploit value == true then plr:Kick()
but before that u could say anti-exploit.Value = DataStore:GetAsync(player.UserId)