Hey, I’m making a script that checks for external guis added by a backdoor.
But I’ve encountered a problem:
for i, v in pairs(game.Players:GetChildren()) do
for i, v in pairs(v.PlayerGui:GetChildren()) do
for i, v in pairs(v.Name:GetChildren()) do
if v.Name == "CodeBox" or v.Name == "Execute" or v.Name == "SS" then
script.Parent.Parent.Text = "found external gui"
else
print(v.Name.. " no signs of external guis.")
end
end
end
end
The error code I’m getting:
Players.V33S.PlayerGui.ScreenGui.Frame.Frame.TextLabel.for :3: attempt to call a nil value - Server - for :3
Stack Begin - Studio
Script 'Players.V33S.PlayerGui.ScreenGui.Frame.Frame.TextLabel.for ', Line 3 - Studio - for :3
Stack End
Simply just renaming these vs to something that describes their contents.
Such as
for _, player in pairs(game.Players:GetChildren()) do
for _, gui in pairs(player.PlayerGui:GetChildren()) do
for _, object in pairs(gui.Name:GetChildren()) do
Also I can’t rename it since it’s a gui the player is not inserting it, and it is only inserted when the game is running, I think that’s how backdoor’s load their guis atleast.
Something like this, also including what I had mentioned
for _, player in pairs(game.Players:GetChildren()) do
for _, gui in pairs(player.PlayerGui:GetChildren()) do
for _, object in pairs(gui:FindFirstChild("Name"):GetChildren()) do
if object.Name == "CodeBox" or object.Name == "Execute" or object.Name == "SS" then
script.Parent.Parent.Text = "found external gui"
else
print(object.Name.. " no signs of external guis.")
end
end
end
end
Keep in mind you’ll get an error if there’s nothing called Name in the gui
Although I think you’re meaning to check the gui and not the contents of the gui
for _, Player in pairs(game.Players:GetPlayers()) do
for _, Gui in pairs(Player:WaitForChild("PlayerGui"):GetChildren()) do
for _, Object in pairs(Gui:GetDescendants()) do
if Object.Name == "CodeBox" or Object.Name == "Execute" or Object.Name == "SS" then
script.Parent.Parent.Text = "Found external gui at player " .. Player.Name .. ", gui object: " .. Object:GetFullName()
-- I would not print for each object
end
end
end
end
Are you trying to run this whilst playing or not? Backdoors can hide on lots of different places too. They just need to send an event to the server. I know much backdoor creators and exploiters are smart to make their gui names different and obscured. This wouldn’t be strong against them.
Edit:
Also, clients can put something on their client, then that will not replicate to the server.
Yes I am trying to run it whilst playing, and I know it isn’t that secure so I will also add a few other things to check since some serversides get leaked you can find patterns in object names and detect them.