So i am making a game where the default key bindings change to different key bindings after the player passes a checkpoint. I made a Area2D checkpoint and connected the node and here's the code below
func _on_Area2D_body_entered(body):
if body.name == "Player":
var ev
ev = InputEventKey.new()
ev.scancode = KEY_X
InputMap.action_erase_events("ui_right")
InputMap.action_add_event("ui_right",ev)
The key bindings change successfully. there's no issue there but the player moves automatically until the new key "x" is pressed