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

Filter Message For Broadcast Error?

I'm trying to make a filter message for broadcast thing so people don't swear in a draw game I'm making, I use this code:

game.Players.LocalPlayer.Chatted:connect(function(msg)
	local filter = game.Chat:FilterStringForBroadcast(msg)
	print(filter)
end)

I don't know if i did something wrong but it says:

04:35:42 -- Argument 2 missing or nil
04:35:42 -- Stack Begin
04:35:42 -- Script 'Players.SaosAccount.PlayerGui.LocalScript', Line 2
04:35:42 -- Stack End

I just need help

1 comment

0

argument 2 is nil as it says, provide a second argument lol

1 answer

You are missing the second parameter on line 2, which would be the player that sent the message.

--Sorry for no indentation, I am writing via phone

local Player = game:GetService("Players").LocalPlayer

Player.Chatted:Connect(function(msg)

local filter = game.Chat:FilterStringForBroadcast (msg, Player)

print(filter)

end)

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