I'm trying to detect whether the screen is tapped or double tapped but my script isn't working?

local ContextActionService = game:GetService("ContextActionService")
local lastTap = tick()

ContextActionService:BindActionAtPriority("TapFunction", function(inputObject)
	if inputObject.UserInputState == Enum.UserInputState.Begin then
		if tick() - lastTap <= 0.3 then
			print("Single Tap")
		else
			print("Double Tap")
			lastTap = tick()
		end
	end
	print("Tap Detected")
end, false, Enum.ContextActionPriority.Default.Value + 25, Enum.UserInputType.Touch)

All that is outputted upon each tap is "Tap Detected"

1 comment

0

Too bad I'm not on mobile, or I'd help you debug ;c