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)
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)
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)
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