Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I ban entire groups from a roblox game?

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?

1 comment

0

;(

2 answers

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

1 comment

0

thank you so much!

u can also do this (scrip in serverScriptService)

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

This discussion is preserved as it was. New answers, comments, and votes are closed.