So i have a chat that im trying to filter but i keep getting the error
21:03:08.956 - Argument 2 missing or nil
This is my code for filtering it.
script.RemoteEvent.OnServerEvent:Connect(function(player,msg)
player.Chatted:Connect(function(msg)
local first = string.sub(msg, 1,3)
if first == "/me" then
if game.Players.LocalPlayer.Character.Head:FindFirstChild("Emote") then
game.Players.LocalPlayer.Character.Head.Emote:Destroy()
end
local gui = Instance.new("BillboardGui", game.Players.LocalPlayer.Character.Head)
local str = game:GetService('Chat'):FilterStringForBroadcast(player)
gui.Name = "Emote"
gui.Size = UDim2.new(7,0,1.5,0)
gui.StudsOffset = Vector3.new(0,3.5,0)
local label = Instance.new("TextLabel", gui)
label.Text = str "**"..script.Parent.Parent.Name.." says "..string.sub(msg, 5,string.len(msg)) ..""
Thanks for your help.
