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

Why does FilterStringAsync() cause a delay?

Asked by
LuaXYZ 5
7 years ago

Okay, so I am the developer of a custom chat and in order for it to be safe for everyone on ROBLOX, I must include FilterStringAsync, which looks a little like this in a SERVER script.

local MessageToFilter = "Hello, how are you?"
local ChatService = game:GetService("Chat")
local PlayerSentFrom = game.Players.takecover
-- Loop all the players and filter string individually for each player
for _,v in ipairs(game.Players:GetPlayers()) do
    local FilteredMessage = ChatService:FilterStringAsync(MessageToFilter, PlayerSentFrom, v)
    print(FilteredMessage)
end
-- I don't know if that would work, I wrote it in this forum.

I was just wondering, when using the chat why there was a short delay for this function. Does anyone have any information about this?

1 answer

Log in to vote
0
Answered by
lukeb50 631 Moderation Voter
7 years ago
Edited 7 years ago

FilterStringAsyncis a YieldFunction

This means that it will pause the script until it gets a response from roblox

0
yield* LifeInDevelopment 364 — 7y
0
Ahhh, thanks for this. LuaXYZ 5 — 7y
Ad

Answer this question