#im trying to ban someone even tough he tries to rejoin. when he says test then he gets banned foreve

11 messages · Page 1 of 1 (latest)

obtuse leafBOT
#

studio** You are now Level 3! **studio

warm panther
#
local BannedDatastore = game:GetService("DataStoreService"):GetDataStore("BannedDatastore2")

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(msg)
        if msg == "test" then
            local Data
            local Success, errormessage = pcall(function()
                Data = BannedDatastore:GetAsync(player.UserId)
            end)

            if Success then
                if (not Data) then return
                player:Kick("You have been banned!")
            end

            local PlayerId = player.UserId

            local success, errormessage = pcall(function()
                BannedDatastore:SetAsync(PlayerId)
            end)

            if success then
                player:Kick("You are banned FOREVER")
            else
                print("what is happening?")
            end
        end
    end)
end)
#

Tell me if this works

#

Sorry, typo

#

I fixed it

#

retry

#

Error message?

#

wait what

#

i got no idea why is it happening

#

Can you send a screenshot of the line?

warm panther
#

Oh yeah its before actually