Oh yeah, I am 100% aware that this only covers a small portion of exploiters, it was a mere attempt to ban offensive words and people that may have a relatively bad exploitation platform that requires chat commands.
Dont worry about offensive words, chat already uses filterstringasync and if you have something public you need to use that function
I’m going in game to test if this works right now.
That’s because in your script the logic is messed up. Since your rank in the group should be 255, you’re doing a check of 255 >= 254, which returns true and then you put it into the not statement which returns false, which ends up running the else statement that kicks you.
You need to flip the sign so that it is <=, so that way it’ll be 255 <= 254 which is false and then false gets evaluated to true, not kicking you. Or you can just remove the not since it’s not needed anyway but oh well.
I’m not the group owner. I’m part of the development team, and the role rank is 254, but I also don’t want it to kick the owner.
Oh, I’m dumb. I misread that. That makes much more sense, I was writing it in a different format before I changed it, so let me test now and I’ll let you know.
The following ‘Commands/Acts’ are the easiest ones to prevent exploiters from doing them:
1.WalkSpeed.
2.JumpPower.
3.Invisibility.
4.Noclip.
5.Flying.
6.Health/GodMode.
7.Chatspam
8.Teleporting.
Always make the anti-cheat on server
You could add an anti cheat for these , to at least ensure these won’t [ possibly highly chances] occur.
These are usually the most important ones that everygame [or at least, great-security games] has.
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.
Oh and never try to use InvokeClient unless its a multithread, because if an exploiter deleted their localscript the script will yield
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)
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
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)
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) then
→ if not true/false then
This is useful for cheaters that use commands like Prison Life 2 or RedWood Prison