I need to detect key presses, but I also need to detect when the key is let go. I want to use ContextActionService so I can easily detect input across platforms without changing my script, but I don't know how to detect when the key is let go.
Here's a gif of my airplane flaps moving: https://i.gyazo.com/e6802616144783ce4531c52c92aad295.gif
I need to know when the W or S key is let go so I can make the flaps FLAT when nothing is pressed.
Here's my current script for how I detect key presses:
local CAS = game:GetService("ContextActionService")
function lift()
hingeConstraint.TargetAngle = 30
end
function dive()
hingeConstraint.TargetAngle = -30
end
function flat()
hingeConstraint.TargetAngle = 0
end
CAS:BindAction("Dive", dive, false, "w")
CAS:BindAction("Lift", lift, false, "s")

3 comments
I'm still confused on how I would use this. I'll edit my question so it includes more of my script. I'll be gone for a few hours in case you don't hear back from me immediately.
You can figure it out.
OK I figured it out. I didn't know that by letting go of a key, BindAction triggers its function.