I want to use the following code to bind the w key to a certain function:
contextAction:BindAction("W function",function()end,false,Enum.KeyCode.W)
However, when I try to use this at the start of the game, the w has not yet been bound by the default character movement binding. So, if I try to use this binding immediately, it would just get overridden by the the later default binding.
So, I came up with two possible solutions, and I would like to have your opinion/solution:
1] unbind the default character movement binding somehow (I don't know how to access it) and then rebind after I finish the function I want to do, or
2] force the binding of the character movement binding at the start of the game so that I can temporarily disable it (Enum.userInputState.Cancel) when I bind another function and then re-enable it once I end my other function.
So, I found a solution that seems to work. Although, I would still like to have the opinion of a veteran.
1] Make your script wait for the Keyboard Movement Module Script located in Players>PlayerName>PlayersScripts>ControlScript>MasterControl>KeyboardMovement.
2] Bind your function and unbind it when you are done so that the character movement binding can continue.