so i making a anti-cheat system, which tries to prevent all possible exploit gui in game, and knowing some of the scripts that cheaters use, they can be found in coregui.
my script (ye my anti-cheat is client-sided💔):
local player = game.Players.LocalPlayer
local flySuspicion = 0
local lastPosition = nil
local lastCheckTime = os.clock()
local character = player.Character or player.CharacterAdded:Wait()
local teleportSuspicion = 0
local ignoreTeleportCheck = false
local allowedNames = {"GFX", "Shiftlock", "StageUI", "TimeUI", "TransitionGui","TopbarCentered","TopbarStandard"}
player.PlayerGui.DescendantAdded:Connect(function(descendant)
if descendant:IsA("ScreenGui") then
local name = descendant.Name
local len = #name
if not table.find(allowedNames, name) then
if len < 10 then
descendant:Destroy()
print("bro really tried to inject script in my game💔")
elseif len >= 10 and len <= 20 then
local isRandom = true
for i = 1, len do
local byte = string.byte(name, i)
if byte < 32 or byte > 126 then
isRandom = false
break
end
end
if isRandom then
descendant:Destroy()
print("bro really tried to inject script in my game💔")
end
end
end
end
end)
----- problem here
game:GetService('CoreGui'):WaitForChild('RobloxGui').DescendantAdded:Connect(function(descendant)
if descendant:IsA("ScreenGui") then
descendant:Destroy()
print("deleted something, idk what: "..descendant.Name)
end
end)
character:WaitForChild("HumanoidRootPart").ChildAdded:Connect(function(child)
if child:IsA("BodyGyro") and not child:HasTag("ServerSided") then
player.Character:Destroy()
task.wait(1)
player:Kick("Exploit Detected.")
elseif child:IsA("BodyVelocity") then
if child.Name ~= "SlapVelocity" and not child:HasTag("ServerSided") then
player.Character:Destroy()
task.wait(1)
player:Kick("Exploit Detected.")
end
end
end)
task.wait(2)
local importantScripts = {"CameraOffset", "Movement", "TSC v1"}
game["Run Service"].RenderStepped:Connect(function()
for _, scriptName in ipairs(importantScripts) do
if not script.Parent:FindFirstChild(scriptName) then
player.Character:Destroy()
task.wait(2)
player:Kick("bro don't try delete any scripts😭")
return
end
end
end)
i apologize if this is in the Roblox documentation, as I am not fluent in english and am using a translator to write this post.