PlayerGui is not a valid member of player

Hi.

So I am writing an anti-cheat and I am stuck on this one part. When something is removed from the PlayerGui, it should kick the player, but it errors saying “PlayerGui is not a valid member of player”

The module:

_player.PlayerGui.ChildRemoved:Connect(function()

if not table.find(_WhitelistedGuis , _player.PlayerGui) then 

_kick("4.4 (GUI Removed)")

    end
end)

Any help would be appreciated, thanks! (note: the kick function works)

Is this the whole script? char

No, It is only a bit of the module script, but this is where its erroring. Everything else works.

Just letting you know if a character destroys something inside their PlayerGui it wont replicate to the server

But it still kicks the player once the GUI is removed, it just doesn’t send the webhook for that specific part of the script

If you want, I can give you the part of the script which sends the webhook report.

Actually, this stopped the error

_player.PlayerGui.ChildRemoved:Connect(function(Child)

if not table.find(_WhitelistedGuis , Child) then 

_kick("4.4 (GUI Removed)")

    end
end)

If this is an anticheat, and is handled by a localscript, then the cheaters will 100% just remove you script before tampering with their own playergui so they don’t get kicked

It is a ModuleScript, in serverscriptservice.

1 Like

So that means if the client deletes their gui the server won’t see it because of client/server boundary

But I also have a client loader, that Is hidden in random places in the character so an exploiter can find it harder to delete.

No matter how hard you hide it, if your anti cheat has localised checks they can be bypassed and tampered. Why anyone would even care if an exploiter deletes a GUI locally I am not sure. I do not think this will have a good end result.