How to get a code that kicks player for saying something?

I want to make code that kicks players for saying “ez” “rekt” and “robux”

1 Like

The Dev Forum is not the place to ask for scripts, you should at least try before asking. To kick a user you can use Player:Kick(). This article may also be helpful

local Words_To_Kick_Player = {
	"ez"; -- remember to put everything else in this format.
    "rekt";
    "robux";
};

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(msg)
		local input = string.lower(msg);

		for k,v in next, (Words_To_Kick_Player) do
			if input:find(v) then
				Player:Kick("Do not say that!");
			end
		end

	end)
end)

Alrighty then, place a script in serverscriptservice then type this:

local words = {"ez", "rekt", "robux"} -- All Your Words Here

game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(chat)
		for _, word in pairs(words) do
			if string.lower(chat) == word then
				player:Kick("Your Reason Here!!") -- Reason To Kick Player
			end
		end
	end)
end)

4 Likes

I made a script for this a while back, it doesn’t actually kick the player but it replaces the message. Here, check it out. Toxic Chat - Roblox

You can also use Player.Chatted and Player:Kick if you want to.

2 Likes

I can’t script, that’s the thing

Will it kick people when they say ez with apastrophe? Or when they say the word ez without apastrophe?

Without apostrophe. But it still works.

Thank you!
Also thanks @DevCramp

1 Like