I'm trying to make a button where the keybind to toggle a GUI is changed by clicking a TextButton - the next key they press will be the new keybind
keybind is the default keybind, it will be updated with the Enum code for the new keybind.
TextButton.Text will also be changed to the current keybind
like this:
[RightShift] [E] [R]
etc.
local keybind = Enum.KeyCode.RightShift
local UIS = game:GetService("UserInputService")
script.Parent.MouseButton1Click:connect(function()
UIS.InputBegan:connect(function(input)
--Detect the next key pressed and nothing else
end)
end)
hope this all makes sense lol

8 comments
Yeah that mostly makes sense... How would I go about changing "keybind" to the new value?
Nevermind... just saw your edit, thanks! I'll give it a try
i make edits often to make sure i fix any flaws, sorry about that. let me know how it goes. (just made another edit)
Now whenever I print keybind.Name I get "InputObject", not sure whats going on
made an edit to line 16, my bad. gotta check the input.KeyCode
Thank you, got it working, gonna mess around with Button.Text to try and get it to display the current keycode.
awesome, good luck.
Managed to do that now too, working perfectly. You're a life saver - this was driving me absolutely insane