Is there anything like mouse.Target
for the UserInputService event, TouchTap
? I was trying to make a handcuff tool in Roblox Studio, but then I ran into a problem that it didn't work for mobile. I searched it up in the Roblox Developer Website and it gave me examples of a gui, not a touch target instance. This is the script:
local UserInputService = game:GetService("UserInputService") local function onTap(touch, gameProcessed) print("Tapped") print(tostring(touch.Target)) end UserInputService.TouchTap:Connect(onTap)
touch.Target
prints out nil
.
While there is nothing quite like mouse.Target for TouchTap, I would hypothesize that you could use ScreenPointToRay in order to derive the same thing, by using the Vector2 it gives you.