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