I need help making my script detect a whole group

  1. I have a game that prints a players name when they are in 2 groups. It flags them and then prints the game.

  2. The script works but only for you when you join the server. My issue is that its printing me but not the whole group and that’s what I need help with.

  3. This is my code:

-- Groups --

local NRB = 4734688               --NRB = Nighthawk Reaper Battalion--
local RC = 3880488                --RC = Red Cell-- --For Now it is TNI--
local RCSF = 4236314              --RCSF = Red Cell Special Forces--
local RCSF:P = 5306090            --RCSF:P = Red Cell Special Forces: Phantoms--
local RCT = 4924452               --RCT = Red Cell Templars--
local RCT:C = 6920519             --Red Cell Templars: Chevaliers--


--Flags--
local Flag1 = "Player in NRB and RC"
local Flag2 = "Player also in RCSF"
local Flag3 = "Player also in RCSF:P"
local Flag4 = "Player also in RCT"
local Flag5 = "Player also in RCT:C"


--Checking Procces--
print("Scanning for corruptions in NRB. Please Stand by.")


--Main Code--
game.Players.PlayerAdded:Connect(function(Player)
	if Player:IsInGroup(NRB) and Player:IsInGroup(RC) then
		print("Detected Curruption.")
		print("Player: "..Player.Name.."Flagged. Reason: ", Flag1)
		if Player:IsInGroup(RCSF) then
			print("Player: "..Player.Name.."Flagged. Reason: ", Flag2)
		end
		if Player:IsInGroup(RCSF:P) then
			print("Player: "..Player.Name.."Flagged. Reason: ", Flag3)
		end
		if Player:IsInGroup(RCT) then
			print("Player: "..Player.Name.."Flagged. Reason: ", Flag4)
		end
		if Player:IsInGroup(RCT:C) then
			print("Player: "..Player.Name.."Flagged. Reason: ", Flag5)
		end
	else
		print("Scanned for curruptions. No one was flagged.")
	end
end)

This is what happens.
image

So what i’m asking for help is. How do I make it check the whole group and not just me? I got told “You’d need to use HTTPService then I believe if you want to detect all players inside a group. You’ll have to use a proxy though, since using it inside of ROBLOX URLs/Domains will not be allowed”

1 Like

Any player that joins will be checked if they’re in the two groups or not, why do you need to print the entirety of the two groups?

Because I want it to check the whole group. This way I can see all players that I shall ban for breaking rules. This way is faster than checking each individual player.

I’m confused. You are checking the whole group as soon as a player joins. If you want to ban a player or any player that’s in the group, just add player:Kick() under the first if statement; any player that joins that’s in the group will show up there – it doesn’t really make sense to traverse the entire group and make a table of those players because you’d have to check that before banning a player anyways.

1 Like

The only reason it’s “just you” right now is because you were the only person testing the game

Ok ill explain. I’m in a group that is very strict (NRB). It is again the rules to be in the enemy group (RC). I want a way for checking if players are in both group and if they are. Officers can punish them. I don’t wont bans from roblox groups or the game. I only want it to print all players in both groups that get flagged. This is the ui:


I will make it so that when you press scan it will scan for the flags and then print all name in the output/console. I hope you have more context now :slight_smile:

Do you mean you want to print everyone in the group? Like, every single player in each group?

what you can do then is add all of your conditions when the player joins, like you have, and add them to dictionary that you can index when you scan for corruption
edit: add the player^

1 Like

Yes. Everyone that is flagged.

Ill updated code added.

Then you’d need to have a datastore.

When a player gets flagged, their ID is put into the datastore. When you scan, you’d make a table of every player in the table then scan from the table.

But cant it just print it into the console? of does it have to be in a datastore?

If you want to have every player that’s ever been flagged in one place then yes, you’d have to use a datastore.

You’ll need to use GroupService if you want to scan offline players (that are not in your server).

Here’s how you can scan through every group member in a group (if needed):

I have read that but I’m still confused on how to implement it and where.

You can accomplish this by using GroupService:GetGroupsAsync(UserId).

where would I add it because i’m not sure.

I’m a bit confused on what you want, do you want to scan players when they join or via another script (offline)?

If you just want to scan when they join, you can use :IsInGroup() instead.

I want to do is this:

  1. Go in the game
  2. Press scan
  3. Script scans both groups
local NRB = 4734688               --NRB = Nighthawk Reaper Battalion--
local RC = 3880488                --RC = Red Cell--
  1. If they are in both they get flagged with
local Flag1 = "Player in NRB and RC"
  1. Print that they are flagged
print("Player: "..Player.Name.."Flagged. Reason: ", Flag1)

image
6) Scan the rest of the groups:

local RCSF = 4236314              --RCSF = Red Cell Special Forces--
local RCSF:P = 5306090            --RCSF:P = Red Cell Special Forces: Phantoms--
local RCT = 4924452               --RCT = Red Cell Templars--
local RCT:C = 6920519             --Red Cell Templars: Chevaliers--
  1. Print the extra flags if there are any
local Flag2 = "Player also in RCSF"
local Flag3 = "Player also in RCSF:P"
local Flag4 = "Player also in RCT"
local Flag5 = "Player also in RCT:C"
  1. I copy the names from the output/console and report the to hicom to get them exiled.

Then you’ll need to use GroupService as I mentioned above.
Everything you need has been provided already.

Since you want to manually scan players (via a GUI), this would be the best option.

Ok. Could you help me implement it because i’m not great at scripting I am very new.