"Click here or press "/" to chat!" I don't know how to set focus to the TextBox for the custom chat GUI i have created.
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() Mouse.KeyDown:connect(function(key) if key == "/" then -- I even tried it with a simple key, to test to make sure the key wasn't the problem. script.Parent.TypeHolder.TextBox.GotFocus = true script.Parent.TypeHolder.TextBox:CaptureFocus() end end)
That's what i have so far, and it fails every time.
The "/" key is restricted to the KeyUp Event for some reason...Therefore, we just need to switch out the two events. Try this:
Player = game.Players.LocalPlayer Mouse = Player:GetMouse() Mouse.KeyUp:connect(function(key) if key == "/" then script.Parent.TypeHolder.TextBox:CaptureFocus() end end)
Try this now. I believe everything in your script was correct besides what I fixed. Anyways, if you have any further problems or questions, please leave a comment below. Hope I helped :P