Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I ban entire groups from a roblox game?

Asked by 3 years ago

My friend had a pet who passed so we made a little memory game for it. It happened to have the name "Bun Bun" in it and the new "hacker group" Bun Bun Girls is raiding. The amount of disrespect is ungodly and I like to ban the group from accessing the game. How can I achieve this?

0
;( AbsurdAwesome101 56 — 3y

2 answers

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

This should work

local bannedGroups = {} --Ids of groups that are banned from this game

local ignoreList = {} --Put UserIds that have an exception to the group ban

local GroupService = game:GetService("GroupService")

game:GetService("Players").PlayerAdded:Connect(function(player)
    local playerIsInGroups = GroupService:GetGroupsAsync(player.UserId)
    for _,currentGroup in pairs(playerIsInGroups) do
        if table.find(bannedGroups,currentGroup.Id) ~= nil and table.find(ignoreList,player.UserId) == nil then
            player:Kick("You are in a banned group "..currentGroup.Name.."")
        end
    end
end)

Credit to xZylter

0
thank you so much! AlbertsSoup -7 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

u can also do this (scrip in serverScriptService)

game.Players.PlayerAdded:Connect(function(Player)
    if Player:IsInGroup(GroupID) then
Player:Kick("Reason")
    end
end)

Answer this question