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 4 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:

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.

1 answer

Log in to vote
3
Answered by 4 years ago
Edited by Ziffixture 4 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