I have tried to make an anti-cheat, but it never works. There was one thing I have always learned from this: Never Trust the client. So I decided to go into server and try to loop every millisecond to see if the local script was edited. Once I did, I proceeded to go into the client one more time to kick them. Plus the chat is never safe, because local scripts are used to create the chat. So if local scripts can be used by anyone, doesn't that mean that the chat isn't safe?
The best way to protect your LocalScript is to clone it, and put it in a safe section. Example: ReplicatedStorage. That LocalScript will be disabled. Next, you will need a regular script that's always enabled, and constantly checks if the LocalScript has been deleted. When that regular script detects that if it has been deleted, then it will clone the LocalScript that was in the safe section, and undisable it. That way, when the exploiter keeps deleting it, it will keep cloning itself.
you can try to put the local script in StarterPlayerScripts, name it something innocent like WelcomeScreen or just LocalScript.
then in ServerScriptService, put a script that has the following source:
game.Players.DescendantRemoving:Connect(function(descendant) if descendant.Parent.Parent:IsA("Player") and descendant:IsA("LocalScript") then local player = descendant.Parent.Parent player:Kick("adios") -- if you want to you can change the kick function to be anything you want to do to the player end end)