Can't find the Chat GUI in PlayerGui

1 - Goal:

I want to enable a feature where typing in the chat triggers the sound of keyboard keys.

2 - Issue:

I can’t locate the Chat GUI element to correctly use the Focused method on the ChatTextBox.

3 - Solutions Attempted:

I’ve explored various solutions but haven’t been able to find one that works.

Code:

local ChatTextBox: TextBox = game.Players.LocalPlayer.PlayerGui:WaitForChild("Chat").Frame.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar.Text
local TypingEnabled: boolean = false

ChatTextBox.Focused:Connect(function() 
    TypingEnabled = true
end)

ChatTextBox.FocusLost:Connect(function()
    TypingEnabled = false    
end)

Issue Encountered:

Running this code results in the following error:

14:51:00.913  Infinite yield possible on 'Players.AB_MAIN.PlayerGui:WaitForChild("Chat")'  -  Studio
14:51:00.913  Stack Begin  -  Studio
14:51:00.913  Script 'Players.AB_MAIN.PlayerGui.CambiarColor', Line 1  -  Studio - CambiarColor:1
14:51:00.913  Stack End  -  Studio
1 Like

i wanted to do this too but you can’t access the chat with textchatservice

You could use this, but this also applies to all TextBoxes in your game:

--LocalScript in StarterPlayerScripts
local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input, processed)
    if input.UserInputType == Enum.UserInputType.TextInput and processed then
        --play sound
    end
end)

Are you using new chat (TextChatService version) or legacy one?

You can check by going to TextChatService in your explorer (click at it) and then check the property named → ChatVersion
image

Im using the new version. The TextChatService version.

that’s why. you cant directly change any of its components (bc they are in coregui)

You can’t. The Chat UI in the new TextChatService is not in PlayerGui, rather in CoreGui, which you cannot access.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.