ContextActionService fires on button down AND button up?

What? Why is my function firing when I lift the “R” key and when I press it down and how can I stop this behavior so that it only fires on button down?

cas:BindAction("Rotate", rotate, true, Enum.KeyCode.R, Enum.KeyCode.ButtonL1, Enum.KeyCode.ButtonR1)

The second argument given to the function is the InputState

function rotate(Event,InputState,InputObject)
if InputState == Enum.UserInputState.Begin then
--Code here
end
end
4 Likes

EDIT: Nevermind I put in the wrong argument. Oof

stuff

It’s not working at all now? :confused:

function rotate(state)
  if state == Enum.UserInputState.Begin and item and item.PrimaryPart then
	 item:SetPrimaryPartCFrame(item:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(rotatenum), 0))
  end
end

function rotate(action, state, object)
if state == Enum.UserInputState.Begin and item and item.PrimaryPart then
item:SetPrimaryPartCFrame(item:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(rotatenum), 0))
end
end