Kick multiple groups?

So I have this small little script that if you are in a group, it kicks you, but I want to make it so it checks multiple groups, and if you are in one of them, you get kicked, how would I do this?\

local Players = game:GetService("Players")

groupId = 0;

function onPlayerAdd(player)
	local rank = player:GetRankInGroup(groupId)
	if (player:IsInGroup(groupId)) then
		player:Kick("You have been kicked from the game")
	else
		player:Kick("You have been kicked from the game")
	end
end

Players.PlayerAdded:connect(onPlayerAdd);

Try using or

If player:IsInGroup(groupId) or player:IsInGroup(groupId) then

Try this function:

local groupIds = {}

function playerInGroup(plr)
    for _, groupId in pairs(groupIds) then
        if plr:IsInGroup(groupId) then
            return true
        end
    end
    return false
end

¿Do you want to make a kick system for more than 1 groups?

Try to use the group id and adjunt it

local Groups = And u make it

local Groups= {GroupId, GroupId , etc};

local function isInBanned(plr)
for i, v in pairs(banned_groups) do
if plr:IsInGroup(v) then
return true;
end
end
return;
end

game:GetService(‘Players’).PlayerAdded:connect(function(plr)
if isInBanned(plr) then
plr:Kick(“Kicked”);
end
end)

Enjoy

Note that the kick screen already includes You have been kicked from the game. Anything you include in the Kick function is added onto that.

Additionally, you should avoid kicking people in specific groups as it can discourage gameplay experiences.

Im kicking mostly known exploiter groups.

Instead, just put effort into good security. What’s the point of banning members in that group when they mostly all have alts?

Still, better safe than sorry, and with no way of avoiding game stealing, its one of my main focus’s.

What you need to understand is that you will get exploiters in your game (even when banning these groups) instead of blocking the issue from joining, stop the issue from causing a problem (write your code with security in mind)

If I wanted to disrupt your game experience, I am unlikely to be in a group as that can incriminate me.

Banning groups is a bad idea and will only cause bad player experience.

Alright. I will keep this in mind

(post deleted by author) ᅟ ᅟ ᅟ