You see, BindAction to me is like the InputBegan with the KeyCode. However, BindAction detects when you press and release the key, and I don’t want that to happen.
Use the user input state
local function handleAction(actionName, inputState, inputObject)
if actionName == "Sprint" then
if inputState == Enum.UserInputState.Begin then
--code here
1 Like
Put
if inputState ~= Enum.UserInputState.End then
return
end
at the start of your function to only progress when the player releases the key (or alternatively change End
to Begin
to make it when the player juat presses the button, not releases it)
1 Like
Better to check for ‘Begin’ as opposed to ‘not End’ as several other enumeration values exist for the ‘UserInputState’ enumeration list.
https://developer.roblox.com/en-us/api-reference/enum/UserInputState
2 Likes