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

I can't make message from player lower. How to fix that?

So.... I want to make filter from Russians Words (because some filtering is not take)

And I can't make string.lower() Where's my error?

local Black_list = {
	["???????? ????"] = true,
	["???????? ?????"] = true,
	["???????? ???"] = true,
	["???????? ?????"] = true,
	["???????? ???????"] = true,
	["????????"] = true,
	["???????? ????"] = true,
}

local TeleportService = game:GetService("TeleportService")

game.Players.PlayerAdded:Connect(function(Player)
	Player.Chatted:Connect(function(Message)
		if Black_list[string.lower(Message)] then
			print("Is bad word")
		else
			print("Not bad word")
		end
	end)
end)

1 comment

0

It should work fine. Perhaps you're looking for string.find?

1 answer

You are doing string.lower() in the index of a dictionary. Try this:

local Black_list = {
    ["???????? ????"] = true,
    ["???????? ?????"] = true,
    ["???????? ???"] = true,
    ["???????? ?????"] = true,
    ["???????? ???????"] = true,
    ["????????"] = true,
    ["???????? ????"] = true,
}
 
local TeleportService = game:GetService("TeleportService")
 
game.Players.PlayerAdded:Connect(function(Player)
    Player.Chatted:Connect(function(Message)
	local LowerMessage = string.lower(Message)
        if Black_list[string.lower(LowerMessage)] then
            print("Is bad word")
        else
            print("Not bad word")
        end
    end)
end)

1 comment

0

Sorry, you didn't helped me. I'm tried.

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