How do I cancel an input if it is already activated?

1- So, what I want is to create a script that when a player presses the “Q” key it activates a transformation

2- But the problem is that when I activate the “Q” key again with the transformation already activated, it simply activates again

3- I didn’t find anything that can help me

Every help is welcome!

Just create boolean variable and check the value of the variable to determine whether or not the transformation will occur again.

local didTransform = false
--...
if didTransform then
  -- player already did transformation
else
  didTransform = true
  -- player did not do transformation
end