Help with unbinding and rebinding jump key to space

  1. What do you want to achieve? Keep it simple and clear!
    In a game i am scripting for, i would like to disable players jump movement temporarily as to prevent them from jumping out of a seat.
  2. What is the issue? Include screenshots / videos if possible!
    I have found many solutions on how to disable it, but none for how to rebind it.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried using a function that disables the humanoid.Jumping value upon jump but that still allows players to exit their seat.

Have you tried setting the JumpPower to 0?

will try, but i doubt that will work

it seemed to work, sometimes the solution is the simplest (idk why i dont try stuff like that)

1 Like

Try to change humanoid’s property JumpPower.

If you want to rebind jump action after unbinding it you should do (LocalScript on StarterCharacterScripts):

local RunService = game:GetService("RunService")
local ContextActionService = game:GetService("ContextActionService")
local Players = game:GetService("Players")

local Client = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):Wait()

local Humanoid = script.Parent:WaitForChild("Humanoid")

local Jumping = false

local function Jump(Action, State)
	if State == Enum.UserInputState.Begin then
		Client.PlayerGui.ArrowsUI.ShadowUp.Visible = true
		Jumping = true
	elseif State == Enum.UserInputState.End then
		Client.PlayerGui.ArrowsUI.ShadowUp.Visible = false
		Jumping = false
	end
end

local function UpdateDirection()
	if Jumping then
		Humanoid.Jump = true
	end
end

ContextActionService:UnbindAction("jumpAction") -- Unbind jump
print("Unbinded")
task.wait(5)
print("Binded Again")

-- Bind jump again --
RunService:BindToRenderStep("Control", Enum.RenderPriority.Input.Value, UpdateDirection)

ContextActionService:BindAction("Jump", Jump, true, Enum.KeyCode.Space, Enum.KeyCode.DPadUp, Enum.KeyCode.ButtonA)
2 Likes

That’s Great! Good luck developing!