(content deleted), JoshRulez101
local KDHandler = script.Parent:FindFirstChild("KDHandler")
if not KDHandler then
script.Parent.Console:Destroy()
end
(I don’t know you hierarchy so I am just guessing)
Yep, as long as the script that is checking if it is deleted is in the same parent.
Would it still work if I place it in the top of an existing random script?
Or you could do something like this:
local found = false
local console = --define here
for I, v in pairs(game.Workspace:GetDescendants()) do
if v.Name == "KDHandler" then
found = true
break
end
end
if found == false then
console:Destroy()
end
Whats the difference between yours and AWhale’s script?
Oops, I misread it and you wanted to search through the entire workspace.
His one actually searches the entire workspace
Why would the console be renamed?
That wont happen because the server checks the changes and any client changes don’t matter to the server.
This would be sold as a product, and people that leak these by sharing the rbxm file to another person, they would try their best to bypass the whitelist, deleter and stuff.
local console = game.Workspace:WaitForChild("Console")
if you still get the error then ur most likely changing it on the server.
What do I do with that? Im using this script:
local found = false
local console = game.Workspace.Console
for I, v in pairs(game.Workspace:GetDescendants()) do
if v.Name == "KDHandler" then
found = true
break
end
end
if found == false then
console:Destroy()
end
And no its not about client stuff, it would get renamed in studio. And the script wouldn’t work because it wasn’t able to find the specific name “Console”
on the first line:
local console = game.Workspace:WaitForChild("Console")
Welp.
You could try using:
for i,v in pairs(game.Workspace:GetDescendants()) do
--Check for the item here
end
Or you could do:
if not game:FindFirstAncestor("KDHandler") then
game.Workspace.Console:Destroy()
end
Hope this helps you fix your problem!
EDIT:
Turns out I was using the wrong method. Fixed it now.
ok so this means Console isn’t a valid member of Workspace, is all the spelling right?
Instance:FindFirstDescendant
does not exist as a proper method, you would do
Instance:FindFirstChild("name", true)
for finding a descendant
If an exploiter renames the console, it wouldn’t affect anything because whatever an exploiter does isn’t reflected to the server