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

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

Asked by
udoxas 75
7 years ago

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)

0
is this a custom gui or the default chat gui? RobloxianDestory 262 — 7y
2
http://wiki.roblox.com/index.php?title=API:Class/TextBox#Events You can connect to Focused and FocusLost on the chat bar. 1waffle1 2908 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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.

Ad

Answer this question