Hello Develepors I wanted to ask on how do I make a GUI that when a player enters a key in a box the key of that specific thing changes. examples of this are in the game called adventure up if you play it and go to its settings it allows us the player to change the key of a ability I want that
COMMUNITY QUESTION
Making A User Change A Key Bind Using A Setting In Game?
2 answers
local UIS = game:GetService("UserInputService")
local GuiTextButton1
local RemoteFunction = game.ReplicatedStorage["whatever your remote function name is"]
local MovePlayer = game.ReplicatedStorage.MovePlayer
local function ChangeClientKeys(dt, n)
RemoteFunction:FireServer(dt, n)
end
UIS.InputBegan:Connect(function(input)
local cik = ClientInputKeys
for _, key in ipairs(cik) do
if key.AssociatedKeyBind == input.KeyCode then
MovePlayer:FireServer()
end
end
end)
GuiButton1.MouseButton1Down:Connect(function()
--[[
Set this up however you want
]]--
end)
NOOB JUST DO THIS AND IT WORULD WORK DUMBO (the old steve was dum i am smarter and this does work but this in a text box ok)
local UIS = game:GetService("UserInputService")
local ButtonClicked = false
local Keycode
UIS.InputBegan:Connect(function(input,gameProcesedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if not ButtonClicked then
print(input.KeyCode.Name)
script.Parent.Text = input.KeyCode.Name
Keycode = input.KeyCode
end
end
end)
script.Parent.Parent.TextButton.MouseButton1Down:Connect(function()
if script.Parent.Parent.TextButton.Text == "Change Key" then
script.Parent.Parent.TextButton.Text = "Done"
ButtonClicked = false
Keycode = " "
else
ButtonClicked = true
script.Parent.Parent.TextButton.Text = "Change Key"
end
end)
UIS.InputBegan:Connect(function(input,gameProcessedEvent)
if input.KeyCode == Keycode then
print("Worked")
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
soo where do i put this? adn woulld this work like the player click the gui press a key and it would show that key?