How do you make a script, that when u type in the chat, the message appears in a text label

How do i make a script when someone chats inside my game, the message the person sent puts the message in a textlabel inside a screengui

I guess…

--LocalScript as a child to the TextLabel
local tcs = game:GetService("TextChatService")
local players = game:GetService("Players")
local label = script.Parent

tcs.OnIncomingMessage:Connect(function(message:TextChatMessage)
    if message.TextSource then
        local player = game.Players:GetPlayerByUserId(message.TextSource.UserId)
        if player then
            label.Text = message.Text
            print("Set text successfully.")
        end
    end
end)

In future, please do not ask people to design entire systems for you like you have here.

Alright, i was just making a chatting game, i wont do that in the future.

1 Like

Well you could just tell him the guide steps not make a “entire system” as you said. No hate.

1 Like