Anti cheat problems, (:getdescendants())

So I’m trying to create an anti cheat, that detects new UI’s inserted, I wrote some code which checks for everything in the game to see if its a UI and put the UI in the table, and then I checked for anything that is being added in the playerGUI, Is there any way to do this, without the need to go through all the descendants in the game to see if its a UI, as for a big game it lags so much!

  • Any help is appretiated!
2 Likes

You could simply check the PlayerGUI

2 Likes

Wdym? Im making it so that if a player gets in a car or something an a new UI pops up, it does not kick the player, thats why I made a table of all the UI’s in the entire game, so that if there was a shop or something and the script inserts the UI in the playerUI it does not kick him, my problem here is when Im making the table I would have to use Get descendants, to check for all UI’s no matter what there parent is

1 Like

Anti cheat is a challenging problem. Instead of putting the UI’s in a table maybe you could just add the ChildAdded event to all the UI’s and if any of them are fired you know something was added.

1 Like

Here is the code, again it works, its just that I’m trying to find a better way to use something else that does not include game:GetDescendants()

> wait()
> local tablee = {} – Table cuz yes
> local arrIndex = 0
> local plr = game.Players.LocalPlayer
> for i,k in pairs(game:GetDescendants()) do
> if k:IsA(“ScreenGui”) then
> tablee[arrIndex] = k
> arrIndex = arrIndex + 1
> end
> end
> plr.PlayerGui.ChildAdded:Connect(function(v)
> if v:IsA(“ScreenGui”) then
> print(“LOL”)
> local found = false
> for i,appa in pairs(tablee) do
> if v.Name == appa.Name then
> --plr:Kick(“Trashcan”)
> found = true
> break
> end
> end
> if found == false then
> plr:Kick(“New UI detected, RNS-DVED”)
> end
> end
> end)
> script.LocalScript.Changed:Connect(function()
> if script.LocalScript.Enabled == false then
> game.Players.LocalPlayer:Kick(“no”)
> end
> end)

1 Like

What do you mean?
You can simPly check under PlayerGUI which is where every GUI goes

The anti cheat checks for UI’s that are odd, and are being added, and that does not already exist in game, that is, like an exploit UI

1 Like

Set a variable for the Player and change “game:GetDescenants” to “player:GetDescendants”

From my experience GUIs can’t be seen while they are in workspace or other places, so that’s useless

1 Like

If a shop in Workspace had code, to like make the UI appear when a part is clicked, then a new UI is being inserted, if that happend using your method would probably kick the player

1 Like

Screenshot 2023-04-09 at 5.28.55 PM

Never said that, you have to check the PlayerGUI as everything outside of it that is not a SurfaceGUU can’t be seems by the Player

If you’re setting GUIs like this your elfi it wrong, you could simply enable them from PlayerGUI

1 Like

I’m sorry to tell you this but the exploiter can just add ui into the CoreGui and you cannot detect it.

3 Likes

I see, thanks for the knowledge, is there anyway to check what is being inserted into the CoreGui?

1 Like

Like I said, you cannot detect it. CoreGui is very restrictive with its functions and events.

1 Like

This script was also just a test, I don’t see this being used anywhere, as number 1, its a client, and number 2, it was poorly made.

There is no way of checking CoreGUI, even though someone said there is
But you can still check for Script Kiddies under PlayerGUI

1 Like

Thanks everyone, turns out creating a UI detecting anti cheat is much harder than I thought…

Don’t even try to do it. It’s pointless

Even if you could check for CoreGui instances, the exploiter can just disable the part of your script thats checking for CoreGui instances.