How do i check if a folder is deleted

I Want to make it so if the anticheat folder i made is deleted in playerscripts the player gets kicked

it does not work

i looked for solutions on the devforum and i didnt find anything

local player = game.Players.LocalPlayer

player.PlayerScripts:WaitForChild("Anticheat").DescendantRemoving:Connect(function(Child)
	if Child.Name == "Anticheat" then
		player:Kick("Imagine trying to delete an anticheat folder")
		end
end)
1 Like

I don’t think you understand what .DescendantRemoving does,
It fires when a descendant removes, you are looking for the Anticheat folder te be removed.

so you should use

local player = game.Players.LocalPlayer

player.PlayerScripts.DescendantRemoving:Connect(function(Child)
	if Child.Name == "Anticheat" then
		player:Kick("Imagine trying to delete an anticheat folder")
		end
end)

Now it fires when a descendant is removed from PlayerScripts.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.