Mouse.Button1Down Mouse.Target Equivalent For Touch Event?

For a mouse, it is simple to get the mouse.Target as follows:

Tool.Equipped:Connect(function(Mouse)
	Mouse.Button1Down:Connect(function()
		print(Mouse.Target)
	end)
end)

The question is, how would I do the equivalent via a touch event on a mobile device? Basically, I would like to figure out what object in the workspace the user touched.

I am also confused if Mouse.Button1Down is triggered on a touch device. In the emulator it does trigger erratically, but I am not sure whether or not it triggers on a real device.

1 Like

You can use the emulator in studio to test with mobile. Try using user input service to recognize when a user taps the screen, and then ray cast using the mouse’s unit ray

2 Likes