The script below successfully disables the jump when the key "b" is held down however I'm trying to re-enable it when the key is released but it's failing to work.
There are no errors given in the output, please help.
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
enabled = true
Mouse.KeyDown:connect(function(key)
if not enabled then
return
end
if key == "b" then
enabled = false
Player.Character.Humanoid.Changed:connect(function()
Player.Character.Humanoid.Jump = false
end)
Mouse.KeyUp:connect(function(key)
if key == "b" then
Player.Character.Humanoid.Jump = true
end
end)
end
enabled = true
end)

1 comment
See if this helps: https://scriptinghelpers.org/questions/22331/why-can-the-player-jump-over-and-over#25947