game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)*
if key == "h" then
script.Parent:CaptureFocus()
end
end)
but when i press "h" it send "h" on the textbox.
How do i make it so it doesn't send the "h" ?
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)*
if key == "h" then
script.Parent:CaptureFocus()
end
end)
but when i press "h" it send "h" on the textbox.
How do i make it so it doesn't send the "h" ?
You need to put a wait before capturing focus, like so
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)*
if key == "h" then
wait()
script.Parent:CaptureFocus()
end
end)
However, you should indent and not use deprecated stuff, so use UserInputService like
game:GetService("UserInputService").InputBegan:Connect(function(key) --its only one letter bigger than keydown!
if key.KeyCode == Enum.KeyCode.H then
wait()
script.Parent:CaptureFocus()
end
end)
Hope this helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.