Determining if a player has been kicked but has not exited the Roblox client?

Often I’ll use Player:IsDescendantOf(game:GetService("Players")) to determine if a player is still in the game. It appears, though, that if I kick a player but they haven’t click the “Leave” button on the CoreGUI that appears, it still shows them as a descendant of players.

This behavior is affecting my anti-exploit. Sometimes, the anti exploit will detect two violations from the player, one on the client and one on the server. For example, it would detect that the player’s HumanoidStateType is PlatformStanding on the server, and that a BodyVelocity has been added to the player on the client. My anti-exploit’s logic is as follows:

If a player is either in PlatformStanding or has a BodyVelocity/BodyGyro in them, it is correct to permanently ban them for flying

This is exactly what it does; however, when a player is banned, the ban message is sent to a webhook as well, like so:

When there are multiple detections, though, it sends the message multiple times, with different reasons (based on what was detected)

I tried to prevent this by not sending another message if the player was not a descendant of game.Players, however this appears to not have an effect. The function I am using to handle this stuff:

Does anyone know how I could prevent this? In other words, how can I determine if a player has been kicked but has not exited the Roblox client?

late response

make a table and mark their name to true after kick

local Kicked = {}

function Kick(Player)
    if not Kicked[Player.Name] then
        Kicked[Player.Name] = true

Try this

	if child:IsA('ClientReplicator') then
		-- code
1 Like