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

[Custom Chat] How to add FilterStringAsync?

Asked by 6 years ago
Edited by M39a9am3R 6 years ago

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

01local chats = script.Parent.Chats
02local last
03 
04function newChat(msg,plr)
05    if #msg > 0 then
06        for i, c in pairs(chats:GetChildren()) do
07            c.Position = c.Position - UDim2.new(0, 0, 0.1, 0)
08        end
09        local newMessage = script.Message:clone()
10        if #chats:GetChildren() == 10 then
11            chats:GetChildren()[1]:Destroy()
12        end
13 
14        if plr.Name == "" then
15        newMessage.TextColor3 = script.Owner.Value
View all 84 lines...
0
The message is being created via the function 'newChat', so it would be best to filter the string there using FilterStringBroadcast, here is a pretty neat tutorial: https://www.youtube.com/watch?v=Ph1nCEIlZ2c YabaDabaD0O 505 — 6y
0
the problem is that if i try to add :FilterStringForBroadcast or :FilterStringAsync to the function it says "Unknown Global: 'newChat'" CrazyScript3r 67 — 6y
0
I heard FilterStringAsync is deprecated, I agree with YabaDabaD0O User#22219 20 — 6y
0
Watch the language! Profanity is not allowed on the website. https://scriptinghelpers.org/help/community-guidelines M39a9am3R 3210 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Try adding this the newChat function, but as a side note, FilterStringForBroadcast only works on Servers

1local chatservice = game:GetService("Chat")
2local 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:

1wait(.1)

Or any other number you want.

0
If your filtering it manually, then you need pcall: http://wiki.roblox.com/index.php?title=Global_namespace/Basic_functions#pcall User#22219 20 — 6y
Ad

Answer this question