Sorry for necrobumping this thread but I don’t think he ever got his question answered.
This is the script I used for my anti-exploit just make it into a local script and it’ll detect whenever a non roblox made GUI is put into the CoreGui and proceed to kick whatever player set it off.
wait(0)
bin = Instance.new("HopperBin", nil)
script.Parent = bin
local Player = game:GetService('Players').LocalPlayer
local coreFunctions = {}
function coreFunctions.CoreLocked(object) -- RobloxLocked Parent
local active, status = pcall(function() object.Parent = object.Parent end)
if active then return false end
return true
end
function coreFunctions.ServiceDescendant(object) -- First Parent
local services = {
game:GetService('Workspace'),
game:GetService('Players'),
game:GetService('Lighting'),
game:GetService('ReplicatedFirst'),
game:GetService('ReplicatedStorage'),
--game:GetService('StarterGui'),
game:GetService('StarterPack'),
game:GetService('StarterPlayer'),
game:GetService('SoundService'),
game:GetService('HttpService'),
}
pcall(function()
for i,v in pairs(services) do
if object:IsDescendantOf(v) then return false end
end
end)
return true
end
function coreFunctions.ClientMember(object) -- ClassName Check
local classes = {
'Script',
'LocalScript',
'CoreScript',
'ModuleScript',
'ScreenGui',
'SurfaceGui',
'Frame',
'ScrollingFrame',
'ImageButton',
'ImageLabel',
'TextBox',
'TextButton',
'TextLabel',
}
local objectName = tostring(tick())
local active, status = pcall(function()
local objectTest = object[objectName]
end)
if status then
local errorClass = status:match(objectName.." is not a valid member of (.*)")
for i,v in pairs(classes) do
if errorClass == v then
return true
end
end
end
return false
end
function coreFunctions.IntegrityCheck(object) -- Valid Object Check
local objectName = tostring(tick())
local active, status = pcall(function()
game:GetService('GuiService'):AddSelectionParent(objectName, object)
game:GetService('GuiService'):RemoveSelectionGroup(objectName)
end)
if status and status:find(objectName) and status:find('GuiService') then return true end
wait()
for i,v in pairs(game:GetService('LogService'):GetLogHistory()) do
if v.message:find(objectName) and v.message:find('GuiService') then return true end
end
return false
end
game.DescendantAdded:connect(function(object) -- DescendantAdded Object Check
if type(object) == 'userdata' and coreFunctions.CoreLocked(object) then
if coreFunctions.ServiceDescendant(object) then
if coreFunctions.ClientMember(object) then
if coreFunctions.IntegrityCheck(object) then -- Confirmed H4X.
Player:Kick() -- Reasonable.
end
end
end
end
end)