Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there any way to see if a player is typing in chat?

I'm trying to add a typing icon above a player when they're typing a message. My problem here is I don't know how to actually detect when a player is typing. Fairly simple question.

I don't want to detect when a player presses the / key because if you click on the chatbox you won't be recognized as typing (nobody does that anyways, but I just want consistency)

2 comments

0

is this a custom gui or the default chat gui?

2

http://wiki.roblox.com/index.php?title=API:Class/TextBox#Events You can connect to Focused and FocusLost on the chat bar.

1 answer

this will get you started

this script will clone the script to all the payer. but for reason it doesnt work in game or in studio testing mode with 2 players (same computer)

put this script Named: "Focus" in ReplicatedStorage

script.Parent.Focused:connect(function()
	print("Player is typing")
end)

script.Parent.FocusLost:connect(function(enterPressed)
    if enterPressed then
        print("Focus was lost because enter was pressed!")
    end
end)

and this Localscript in StarterPlayerScripts

local script = game.ReplicatedStorage.Focus:clone()
local player = game.Players.LocalPlayer
	local chatbar = player.PlayerGui:WaitForChild("Chat").DestroyGuardFrame.Frame.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar
	script.Parent = chatbar

it will clone the Focus script from ReplicatedStorage into the chat box where you type either if you click it or press / and will stop when you press Enter, so good luck, the rest is up to you now.

This discussion is preserved as it was. New answers, comments, and votes are closed.