I've tried to make this chat GUI, with a custom chat bar. As usual, the script works in Studio, but not in the client, and I was wondering if I would need to change it otherwise.
The script
local service = game:GetService("UserInputService")
local gui = script.Parent
service.InputBegan:connect(function(keyPressed,gameProcessedEvent)
if gameProcessedEvent then
return end
if script.Parent.Parent.Status.Value == true then
if keyPressed.KeyCode == Enum.KeyCode.E then
gui.TextBox:CaptureFocus()
end
end
end)

6 comments
Is this a LocalScript?
Yeah
Tested it under the circumstances your code runs on, the only thing that could be wrong is if the rest of your code isn't passing the if statement, or if TextBox doesn't exist.
Otherwise it worked fine for me.
Huh. I guess I'll try something else then. Thanks anyway.
Make sure Status is true and in your PlayerGui. Otherwise, I see nothing wrong with it.