Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Filter Message For Broadcast Error?

Asked by 5 years ago

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

0
argument 2 is nil as it says, provide a second argument lol Fifkee 2017 — 5y

1 answer

Log in to vote
0
Answered by
Despayr 505 Moderation Voter
5 years ago

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)
Ad

Answer this question