I am working on a anticheat that makes it so no type of exploits are possible. Even Btools! I seem to be getting an error in my module that says attempted to index nil with 'FindFirstChild' on line 29. Any help would be greatly appreciated.

local module = {}
ValidKeys = {}
GUiNumber = {}
game.Players.PlayerAdded:Connect(function(plr)
player = plr
end)
ValidGui1 = game.StarterGui.ValidGui
function module.Store(key, UiNumber)
	table.insert(ValidKeys, key)
	table.insert(GUiNumber, UiNumber)
end
function module.GetFullPath(Ui)
    partPath = Ui:GetFullName()
	local appendStr = "game."
end
function module.GiveGuiKey(Ui)
	local key = Instance.new("StringValue")
	local hasgivenkey = nil
	module.GetFullPath(Ui)
	key.Parent = Ui
	key.Name = "key"
	key.Value = math.random(154122412, 521532125)
		hasgivenkey = true
	module.Store(key.Value, partPath)
end
function module.CheckForExploits()
	for i,v in pairs(ValidKeys) do
		local guinumber = GUiNumber[v]
		local iskey = guinumber:FindFirstChild("key")
		if iskey then
			local key = GUiNumber[v]:FindFirstChild("key")
			if key.Value ~= v then
				script.RemoteEvent:FireServer(plr)
			end
		else
			script.RemoteEvent:FireServer(plr)
		end
	end
end
function module.DistributeKeys(get)
	for i, v in pairs(get:GetChildren()) do
		if v:IsA("ScreenGui") and not v:FindFirstChild("key") then
			module.GiveGuiKey(v)
		end
	end
	print(GUiNumber)
end
return module

1 comment

0

This type of anti cheat isnt really possible. If your trying to get the client to send a message to the server when there is suspicious Gui, an exploiter could prevent this message from being sent. If your trying to detect this gui from the server, it wont work either as guis that are added from the client aren't replicated to the server so the server wouldn't be able to see the gui even if its th