So I'm trying to create an anti-cheat script I saw in a game. It would detect if there is a new undetected GUI for a player (e.g a remotespy GUI) so it will ban it. However, whenever I write game.CoreGui, it will just say The current identity (2) cannot Class security check (lacking permission 1). The localscript is in StarterCharacterScripts. I got 2 actually, one has this:
local plr = game.Players.LocalPlayer game.DescendantAdded:Connect(function(d) if (d.Parent==game.CoreGui) then if (d.Name == "SpyScroller") then local http = game:GetService("HttpService") local Data = { ["content"] = plr.Name .. " used a cheat. Cheat: Not game-source local GUI! Probably using remote spy. Banned for 1 week!" } Data = http:JSONEncode(Data) http:PostAsync("mydiscordwebhooklink", Data) --Put the link you saved between the two quotes. plr:Kick("You have been banned for using cheats! Duration: 1 week! Appeal in our discord server, #banappeals") end end end)
and one has this:
local safeguinames = {"admingui"} local normalamount = 4 --Don't edit this. local plr = game.Players.LocalPlayer while wait() do if (#plr.PlayerGui:GetChildren() >= #safeguinames) then --check if it's admingui if (#plr.PlayerGui:GetChildren() == 5 and plr.PlayerGui:FindFirstChild("admingui")==false) then --ban. local http = game:GetService("HttpService") local Data = { ["content"] = plr.Name .. " used a cheat. Cheat: Not game-source local GUI! Probably using remote spy. Banned for 1 week!" } Data = http:JSONEncode(Data) http:PostAsync("discordhook", Data) --Put the link you saved between the two quotes. plr:Kick("You have been banned for using cheats! Duration: 1 week! Appeal in our discord server, #banappeals") end if (#game.CoreGui:GetChildren()==8) then -- I think this part is not needed if I have that first script, but it still gives the same error local http = game:GetService("HttpService") local Data = { ["content"] = plr.Name .. " used a cheat. Cheat: Not game-source local GUI! Probably using remote spy. Banned for 1 week!" } Data = http:JSONEncode(Data) http:PostAsync("stillmydiscordhook", Data) --Put the link you saved between the two quotes. plr:Kick("You have been banned for using cheats! Duration: 1 week! Appeal in our discord server, #banappeals") end end end --And I know it won't ban, this is just testing..
EDIT: Don't care about the dumb script I have many things to do with it but I want to solve this problem first. So what should I do?