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

It is possible to filter a string?

My chat won't work because it needs a chat filter, but everything I try it fails

local msg = game.Chat:FilterStringForBroadcast(message)

This returns nil There is a secret way to filter? EDIT:

--This is the script what works
local suc, errormsg = pcall(function()
int2.Name = plr.Name.." is now Joined!!!"
end)
if suc then
	print("Success!")
else
	warn("Fail, " .. errormsg)
end
plr.Chatted:Connect(function(msg)
local int = script.Parent.Chats
local int2 = Instance.new("StringValue", int)
local msg2 = string.upper(msg:sub(0, 1))..msg:sub(2)
local biztositek = string.len(msg2)
local biztositek2 = "."
if string.sub(msg2, biztositek) == "!" or string.sub(msg2, biztositek) == "?" then
	biztositek2 = ""
end
local suc, errormsg = pcall(function()
int2.Name = plr.Name..": "..msg2..biztositek2
int2.Value = biztositek
end)
if suc then
	print("Success!")
else
	warn("Fail, " .. errormsg)
end
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
	wait(1)
	local int = script.Parent.Chats
local int2 = Instance.new("StringValue", int)
local suc, errormsg = pcall(function()
int2.Name = plr.Name.." is now Left."
end)
if suc then
	print("Success!")
else
	warn("Fail, " .. errormsg)
end
end)

2 comments

0

Please note that filtering does not work inside roblox studio.

0

But not works in global server

1 answer

It returns nil because there is nothing in (message)

you need to use Player.Chatted event then connect it to a function ,the parameter would be what the player is saying ,use the parameter from player.chatted and put it in ,Chat:FilterStringForBroadcast(chat parameter)

2 comments

0

ok

0

But you looks me a noob

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