How do I detect a GUI being made in CoreGui, StarterGui and PlayerGui for example if I had an "exploit" and I execute a GUI how would I detect that like this
local screenguii = Instance.new("ScreenGui") local framee = Instance.new("Frame") screenguii.Parent = game.CoreGui framee.Parent = screenguii
How would I make a check if there was a new GUI in CoreGui?
I want to make an anti-cheat so exploiters don't get any sort of an advantage.
The problem is, they're executing it locally. This means that the server can't pick up on what they added to their client unless you give the information to it first. You should try seeing if any changes have been made locally first, then send the information to the server by using Remote Events or Functions. Then you could try removing them. However, I haven't tried this, but if it was that simple, then why haven't other games used it? They could also try remove the local script. This is why it's almost impossible to stop exploits.
You would listen when a Child has been added into the PlayerGui, and checking whether the Descendant's Name can be found inside StarterGui (I'm sure there are more advanced ways of checking this, but you get the idea):
local LocalPlayer = game:GetService("Players").LocalPlayer local PlayerGui = LocalPlayer:WaitForChild("PlayerGui") PlayerGui.ChildAdded:Connect(function(Child) if not game:GetService("StarterGui"):FindFirstChild(Child.Name) then --possibly adding something on their own end end)