Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

DescendantAdded isn't working correctly?

so I have this "Anti-Cheat" I'm trying to make but Its literally saying Chat is not on the exceptions even though it is I'm super confused even though it's probably simple :/

player.PlayerGui.DescendantAdded:Connect(function(Descendant)
	if Descendant:IsA("ScreenGui") then
		print(Descendant.Name)
		if Descendant.Name ~= "Chat" or Descendant.Name ~= "BubbleChat" or Descendant.Name ~= "FreeCam"  then
		print(Descendant.Name.." is not on the exceptions ")
		player:Kick("Anti-Cheat:"..player.Name.." Banned for 99999999 days           jk just don't do it again -_-")
		end
	end 
end)

2 comments

0

Are you trying to kick a player if they chat a certain message?

0

no, I'm trying to make it so if a Gui gets added to a players PlayerGui and it's not supposed to be there then they get kicked but I have the Chat gui in the exceptions so it shouldn't kick them but it still does

1 answer

I figured it out I don't know how this makes much of a difference at all but it works I just have to use a bunch of elseifs here's the code if anyone ever has a similar issue or just wants to steal the code:

print("Anti-Cheat Loaded")
local player = game.Players.LocalPlayer
player.PlayerGui.DescendantAdded:Connect(function(Descendant)
if Descendant:IsA("ScreenGui") then
		local name = Descendant.Name
		print(name)
	if name == "Chat" then
		print(name.." is on the exceptions ")
		
	elseif name == "BubbleChat"	then
		print(name.." is on the exceptions ")
	elseif name == "Freecam" then
		print(name.." is on the exceptions ")	
		else
			print(name.." is not on the exceptions")
			player:Kick("Anti-Cheat:"..player.Name.." Banned for 99999999 days           jk just don't do it again -_-")
		end
	end 
end)

p.s. the point of this script is to make sure an exploiter can't add a Gui in PlayerGui just add a elseif for all of your Guis

This discussion is preserved as it was. New answers, comments, and votes are closed.