Chat Anti-Exploit System with Group Rank Bypass

I’m still being kicked, the current code is as follows:

local groupID = 12986119
local groupRank = 254

local BannedWords = {
-- ...
};


game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if table.find(BannedWords, msg) then
			if (plr:GetRankInGroup(groupID) <= groupRank) then
				print("Group rank bypass | Attempted word: "..msg)
				return;
			else
				plr:Kick("AE | Banned word usage.\n Word: "..msg)
				print("Player kicked Word: "..msg)
			end
		end
		
	end)
end)

Also thank you, I will most likely do this at some point.

2 Likes

Oh and never try to use InvokeClient unless its a multithread, because if an exploiter deleted their localscript the script will yield

2 Likes

You should use both, a server anticheat and a client anticheat whose only function is to check if the localscript is nil (although it won’t serve much purpose)

2 Likes

Forgot to flip the sign. I am most likely the slowest, most monkey-brained person on the forums. Although, it is still kicking me with the following script:

local groupID = 12986119
local groupRank = 254

local BannedWords = {
-- ...
};


game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if table.find(BannedWords, msg) then
			if (plr:GetRankInGroup(groupID) >= groupRank) then
				print("Group rank bypass | Attempted word: "..msg)
				return;
			else
				plr:Kick("AE | Banned word usage.\n Word: "..msg)
				print("Player kicked Word: "..msg)
			end
		end
		
	end)
end)

One thing as well, you should use a pcall or else your script could error

Can you also say (print(plr:GetRankIngGroup))??

To check what is your rank

Aha! I fixed it. I truly am the stupidest on the forum. I forgot to commit the script. This is why I’m not a scripter :joy:

2 Likes

That’s great, here is the same script but with a pcall

local groupID = 12986119
local groupRank = 254

local BannedWords = {
-- ...
};


game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if table.find(BannedWords, msg) then
local rankInGroup
local success, response = pcall(function()
rankInGroup = plr:GetRankInGroup(groupID)
end)
if not success then return end --Failed to retrieve rank in group (API errror)
if rankInGroup >= groupRank then
				print("Group rank bypass | Attempted word: "..msg)
				return;
			else
				plr:Kick("AE | Banned word usage.\n Word: "..msg)
				print("Player kicked Word: "..msg)
			end
		end
		
	end)
end)
1 Like

Also sorry im on mobile xd aa 30

Btw @MochaTheDev you should use string.split as well, this will return arguments

“Lol xd” → “Lol” “xd”

So that if somebody says

“:cmds lol” it can work

If the command system already checks whether the user’s an admin and gives said user the privilege, I don’t see the point in this. It sounds more like an oversight in the command system’s programming.

Being on topic, this won’t work as intended-
if not plr:GetRankInGroup(groupID) >= groupRank then
When you use not with a value, it makes the statement the opposite per se. not true = false, not false = true. The problem’s that when you use it for something like if not a == b then, it’s saying if (not a) == b then / if true/false == b then. The solution’s the wrap the condition in parentheses if not (a == b) then since, similar to PEMDAS, it will do the parentheses first and then the not. if not (a == b) thenif not true/false then

2 Likes

This is useful for cheaters that use commands like Prison Life 2 or RedWood Prison

1 Like