i have the following code which breaks completely if I remove the task.wait(1)
:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TextChatService = game:GetService("TextChatService")
local SendPlayerSystemMessageEvent = ReplicatedStorage:WaitForChild("SendPlayerSystemMessage")
local SystemChatChannel : TextChannel = TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXSystem")
SendPlayerSystemMessageEvent.OnClientEvent:Connect(function(...)
task.wait(1)
local text = ""
local messages = { ... }
local messageCount = #messages
for i, message in ipairs(messages) do
text = text .. message .. (i + 1 <= messageCount and "\n" or "")
end
SystemChatChannel:DisplaySystemMessage(text)
end)
How can I verify these TextChannels are fully loaded if WaitForChild
is not sufficient?
I should also mention that using
while not SystemChatChannel do task.wait(1) end
was not a solution (that also makes it break)