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);
local groupIds = {}
function playerInGroup(plr)
for _, groupId in pairs(groupIds) then
if plr:IsInGroup(groupId) then
return true
end
end
return false
end
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)
local group_blacklist = {
0;
0;
0;
}
game:GetService("Players").PlayerAdded:Connect(function(player)
for _,id in ipairs(group_blacklist) do
if player:IsInGroup(id) then
player:Kick("You are part of a blacklisted group")
end
end
end)
Just to add onto @ElliottLMzâs reply, most exploiters donât belong to a group on the roblox platform. They can easily bypass this system by creating a new account or leaving the group. If you want to bar individual exploiters from accessing your game, focus on having good game security with exploit detection.
Personally, I use a âstrikeâ system where the server will flag a player if it detects unusual activity from them, such as erratic changes in the y-component of their position in relation to the ground below them (flying), excessive firing of RemoteEvents or RemoteFunctions, or invalid/impossible arguments sent through these remotes. If a player is flagged enough times (to rule out false positives), they are kicked from the game.