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

Issues with UserInputService not detecting keys?

Asked by 7 years ago

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)
0
Is this a LocalScript? M39a9am3R 3210 — 7y
0
Yeah TheHospitalDev 1134 — 7y
0
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. ScriptGuider 5640 — 7y
0
Otherwise it worked fine for me. ScriptGuider 5640 — 7y
View all comments (2 more)
0
Huh. I guess I'll try something else then. Thanks anyway. TheHospitalDev 1134 — 7y
0
Make sure Status is true and in your PlayerGui. Otherwise, I see nothing wrong with it. M39a9am3R 3210 — 7y

Answer this question