I need help with my script

I am making a checker for corruption for a group i’m in. I’m not that good at scripting. I have tried this but it dosnt work.

local NRB = 4734688
local RC = 3880488
player = plr.name
Flag1 = "Player in NRB and RC"

if player in NRB and RC then
print("Player:"+Player+"Flag Reason:"+ Flag1)

end
  • Is this the entire script?

  • You aren’t concatenating your print statements (Unless if the pluses count)

  • I’d use local variables for the player & flag variables

  • Are you getting any errors in the Output?

  • Is this the entire script? Yes
  • Are you getting any errors in the Output? Yes

It depends on what you’re exactly doing here, if you’re handling this on a ServerScript you’ll have to reference the Player a different way

If this is on a LocalScript, yes you can easily reference the Player just by doing game.Players.LocalPlayer

Also I’m not certain on what this means, is corruption an asset of some sort?

corruption Basically if a person in in both groups they are corrupt as its not aloud. Also its in a server script

In order to check if a player is a member of a group, you can use Player:GetRankInGroup().

Try this code:

local Players = game:GetService("Players")

local NRB = 4734688
local RC = 3880488

Players.PlayerAdded:Connect(function(Player)
	if Player:GetRankInGroup(NRB) > 0 and Player:GetRankInGroup(RC) > 0 then
		print("Player: " .. Player.Name .. " flagged; Player in NRB and RC.")
		Player:Kick("Corrupt member.")
	end
end)

Code summary:
Whenever a player joins, it checks if they are in the Nighthawk Reaper Batallion and The Red Cell. If they are members of those groups, it will print that they are flagged. Whatever you wish to do to members of this group, make sure to put inside the if statement. I added an extra kick feature, as it seems you want to disallow these players from your game. Take it out if I misinterpreted.

1 Like

You do realize there is a function for this, called IsInGroup() right? It returns a Bool depending if they are in the group or not (But I suppose that works too, just that I’d recommend using the more logic-based one)

local NRB = 4734688
local RC = 3880488
local Flag1 = "Player in NRB and RC"

game.Players.PlayerAdded:Connect(function(Player)
    if Player:IsInGroup(NRB) and Player:IsInGroup(RC) then
        print("Player: "..Player.Name.."flagged. Reason: ", Flag1)
	    Player:Kick("No")
    end
end)

(Btw both of these scripts should belong in ServerScriptService as a Server Script)

I forgot to add the darn Kick function

Never knew this was a method! Thanks for the information. Anyways I would still choose checking the rank over whether they are in the group or not just for more capabilities with it, but thank you for the input.

its not working.

  15:21:15.233  Player: Aapocalypse_Gamingflagged. Reason:  Player in NRB and RC  -  Server - Script:8
  15:21:15.234  Scaned All Corruptions.  -  Server - Script:9
local NRB = 4734688
local RC = 1174414
local Flag1 = "Player in NRB and RC"
print("Scanning...")

game.Players.PlayerAdded:Connect(function(Player)
	if Player:IsInGroup(NRB) and Player:IsInGroup(RC) then
		print("Player: "..Player.Name.."flagged. Reason: ", Flag1)
		print("Detected Corruptions.")
	end
end)
print("Scanned.")

Its only printing me. And not everyone.

If you’re testing this on a “Play Solo” simulation, it’ll only work for you

PlayerAdded should fire as soon as a Player first joins the game? Did you remember to referenc it inside ServerScriptService? (Also that’s not my updated code)

I added some prints and changed the group that’s all.

Yes

no?

Do that then

If that doesn’t work for some reason, try using @Galactiq’s code instead

Does the same thing. It has the same outcome. Its only scanning me and not the whole group.

image

What do you mean by “the whole group”? Are you wanting to get every player inside those 2 groups…?

Yes. That’s what I meant. Sorry if I didn’t make that clear.

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

Ok. Do you know how to help me with this or no. If not that’s fine.

Not really, but I suppose I can give you some insights on where to search:

  • HTTPService provides the ability to create integration as long as they’re third-party based URLs (Supposedly they’re used for obtaining information outside of other websites, such as youtube.com, randomwebsite.com, etc)

  • I suppose you can search how to create your own proxy so that you can create your own website out of ROBLOX’s domains

I made a new topic about this because i’m still not sure.