Ban system feedback

Good morning, good afternoon or good night. I’m creating with the help of some friends, and a tip from a programmer on DevForum, a ban code for achievement. Let’s say that “Leo” wants to use Exploit in his game, so he uses that Exploit and unlocks everything, however, however, all of these equipment were connected to various Achievements, which, instead of being dropped to the player in a normal session, they are separate servers, different worlds. That is, server 1, which we will call “Lobby”, only recognizes if you have this Achievement or not and releases these equipment for you. However, when “Leo” unlocks them without “Achievement” the Script on the server will detect something strange and will do a double check, and if it finds that you don’t even have a “save” of those worlds and don’t even have the Achievement you enter an infinite ban loop.
(I’m Brazilian and I’ve just started, so I don’t lose any notes in the code I’ll keep the translation in Portuguese as it is, if you can’t change it when I send it to English. I apologize)

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- Função para verificar se um jogador possui o achievement necessário
local function HasAchievement(player)
    -- Verifique se o jogador possui o achievement necessário
  
    return false -- Substitua por sua lógica de verificação de achievement
end

-- Evento que é acionado quando um jogador entra no jogo
local function OnPlayerAdded(player)
    -- Verifique se o jogador possui o achievement necessário
    if not HasAchievement(player) then
        -- Banir o jogador
        
        print("Jogador banido: " .. player.Name)
    end
end

-- Conecte o evento ao evento PlayerAdded
Players.PlayerAdded:Connect(OnPlayerAdded)

-- Exemplo de como desbloquear um achievement para um jogador
local function UnlockAchievement(player)
    -- Verifique se o jogador já possui o achievement
    if HasAchievement(player) then
        return -- O jogador já possui o achievement, não é necessário fazer nada
    end

    -- Desbloqueie o achievement para o jogador
    
    print("Achievement desbloqueado para o jogador: " .. player.Name)
end

-- Exemplo de como desbloquear um achievement para um jogador específico
local playerToUnlock = Players:FindFirstChild("Leo")
if playerToUnlock then
    UnlockAchievement(playerToUnlock)
end

2 Likes