Unable to detect touch input from ImageButton

  1. What do you want to achieve?: Detect touch input from ImageButton

  2. What is the issue?: Works perfectly with mouse input, but nothing happens with touch input (No error messages in output as well). I’ve used this method in other applications and it works flawlessly, not sure why I’m having an issue with it now.

  3. What solutions have you tried so far?: Tried GuiObject.Activated, as well as InputBegan

I’m using a for loop to iterate through a lot of ImageButtons

for _,vehicle in ipairs(CarPreviews:GetChildren()) do

	nextCarPreview = CarPreview:Clone()
	nextCarPreview.Name = vehicle.Name

	setViewport(vehicle, nextCarPreview)
	local clickedFrame = nextCarPreview.Clicked
	
	local function SelectVehicle()
		showFrame(clickedFrame)
	end
	
	nextCarPreview.Activated:Connect(SelectVehicle)

	nextCarPreview.Parent = SelectionFrame
end

Functions being used for opening and closing a frame within each ImageButton:

function hideAllFrames()
	for _,preview in ipairs(SelectionFrame:GetChildren()) do
		if preview:IsA("ImageButton") then
			preview.Clicked.Visible = false
			print("not visible")
		end
	end
end

function showFrame(frame)
	hideAllFrames()
	frame.Visible = true
	print("visible")
end

Try using ImageButton.Activated. That will detect touch input.

That’s what I’m currently using

If you want the best input, try using MouseButton1Cluck and/or MouseEnter.

But does MouseButton1Click work for touch on mobile devices?

Edit: Tried this but I’m still having the same issue. It works fine with mouse input, but does not register touch input. I tried using a print statement to verify if the input is even registering, and I noticed that it only registers with mouse clicks.