Is there any way to check if the message player sent contains specific text?

  1. What do you want to achieve? Keep it simple and clear!
    Well, I want to give the player a strike if they sent a message that Roblox wouldn’t normally filter but it would ruin the game, so I want to check if the message they sent contains specific text.
  2. What is the issue? Include screenshots / videos if possible!
    The issue is that I cant seem to find anywhere anything linked to this.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried searching on youtube and google, nothing found. I just found the how to check if a player sent ex: /fly etc…
2 Likes

You’re talking about the in-game roblox chat??

Well, yes. As i said i wanted to check if the player’s message contains specific text.

If so, then try this:

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(msg)
        local loweredText = string.lower(msg)
        if string.find(loweredText, "Word Here") then
            -- Do Whatever Here
            player:Kick("You called someone a name")
        end
    end)
end)
2 Likes

Hello, how are you doing?

To answer this question, you can do:

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(message)
		local messagelower = string.lower(message)
		local splitString = messagelower:split(" ")
		for i, v in pairs (splitString) do
			if v == "You're Message" then
				--you're code
			end
		end
    end)
end)

Recipient is deprecated. Player | Roblox Creator Documentation

1 Like

Forgot about that, i have no idea why i put it there.
Thanks for the reminder

1 Like

What was you’re original reply? Do you need anything else?

No sorry, I somehow replied to the wrong topic.

Alright then, have a good day!