Okay, so im trying to use a Custom Chat i found.. (Ofcourse im going to edit it..) But first im trying to make it works with FilterStringAsync.. But when i try it it gives errors and stuff ;-; tried to look up a custom chat with FilterStringAsync but couldnt really find one :/
Please help me with this
local chats = script.Parent.Chats local last function newChat(msg,plr) if #msg > 0 then for i, c in pairs(chats:GetChildren()) do c.Position = c.Position - UDim2.new(0, 0, 0.1, 0) end local newMessage = script.Message:clone() if #chats:GetChildren() == 10 then chats:GetChildren()[1]:Destroy() end if plr.Name == "" then newMessage.TextColor3 = script.Owner.Value newMessage.Text = "[OWNER] " .. plr.Name ..": ".. msg elseif plr.Name == "" or plr.Name == "" or plr.Name == "" then newMessage.TextColor3 = script.Admin.Value newMessage.Text = "[ADMIN] " .. plr.Name ..": ".. msg elseif game:GetService("GamePassService"):PlayerHasPass(plr, 0)then newMessage.TextColor3 = script.VIP.Value newMessage.Text = "[VIP]" .. plr.Name ..": ".. msg else newMessage.Text = plr.Name ..": ".. msg end newMessage.Position = UDim2.new(0, 0, 0.9, 0) newMessage.Parent = chats last = newMessage end end function join(plr) for i, c in pairs(chats:GetChildren()) do c.Position = c.Position - UDim2.new(0, 0, 0.1, 0) end local newMessage = script.Message:clone() if #chats:GetChildren() == 10 then chats:GetChildren()[1]:Destroy() end newMessage.Text = "[CONSOLE] " .. plr.Name .. " joined the server!" newMessage.TextColor3 = script.CONSOLE.Value newMessage.Position = UDim2.new(0, 0, 0.9, 0) newMessage.Parent = chats last = newMessage end function left(plr) for i, c in pairs(chats:GetChildren()) do c.Position = c.Position - UDim2.new(0, 0, 0.1, 0) end local newMessage = script.Message:clone() if #chats:GetChildren() == 10 then chats:GetChildren()[1]:Destroy() end newMessage.Text = "[CONSOLE] " .. plr.Name .. " left the server." newMessage.TextColor3 = script.CONSOLE.Value newMessage.Position = UDim2.new(0, 0, 0.9, 0) newMessage.Parent = chats last = newMessage end game.Players.PlayerAdded:connect(function(plr) join(plr) end) game.Players.PlayerRemoving:connect(function(plr) left(plr) end) game.Players.PlayerAdded:connect(function(plr) plr.Chatted:connect(function(msg) newChat(msg, plr) end) end) for i, player in pairs(game.Players:GetPlayers()) do player.Chatted:connect(function(msg) newChat(msg, player) end) end
Try adding this the newChat
function, but as a side note, FilterStringForBroadcast
only works on Servers
local chatservice = game:GetService("Chat") local newmessage = chatservice:FilterStringForBroadcast(msg, plr)
Then change msg
to newmessage
OR
You can wait until the message is filtered, since the custom chat your using is using the Chatted
event. So you could add:
wait(.1)
Or any other number you want.