Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is There Anything like "mouse.Target" for the UserInputService event, TouchTap?

Asked by 5 years ago

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:

1local UserInputService = game:GetService("UserInputService")
2 
3local function onTap(touch, gameProcessed)
4    print("Tapped")
5    print(tostring(touch.Target))
6end
7 
8UserInputService.TouchTap:Connect(onTap)

touch.Target prints out nil.

1 answer

Log in to vote
3
Answered by 5 years ago
Edited by Ziffixture 5 years ago

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.

Ad

Answer this question