Keybind gui system rebinding jump action

Hello,
I am trying to achieve that I can rebind my jump action
but somehow I am failing 24/7.



local Player = game:GetService("Players").LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")

local UserInputService = game:GetService("UserInputService")
character:WaitForChild("Humanoid")
local humanoid = character.Humanoid
local actionname = "jumpAction"
local r = false
local module = require(Player.PlayerScripts.PlayerModule.ControlModule.Keyboard)


local ContextActionService = game:GetService("ContextActionService")
function JumpButtonButtonOnClick()
	script.Parent.Text = "НаТмитС Π»ΡŽΠ±ΡƒΡŽ ΠΊΠ»Π°Π²ΠΈΡˆΡƒ"
	local a = false
	UserInputService.InputBegan:connect(function(keyCode)
		if not a then
			if keyCode.UserInputType == Enum.UserInputType.MouseButton1 or keyCode.UserInputType == Enum.UserInputType.MouseButton2  then return end
			local b= getKeyCodeString(keyCode.keyCode)
			print(b)
 			script.Parent .Text =b
			print(tostring(keyCode.keyCode))
			module:BindContextActions(keyCode.keyCode)
			a=true
		end
	end)
end

script.Parent.MouseButton1Click:Connect(JumpButtonButtonOnClick)

function getKeyCodeString(keyCode)
	return string.gsub(tostring(keyCode),"Enum.KeyCode.","")
end

gagagag.rbxl (146,3 KB)
This is the game file to test it out ur own.
grafik
made an edit here

1 Like