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

How do you work with Mouse.Target for mobile devices?

Asked by 6 years ago
Edited 6 years ago

I stumbled upon a problem into migrating a game into mobile devices. I would like to get the target of what last pressed in the game in mobile devices. I tried using Mouse.Target, but i bind it to RenderStepped. I also tried looking in the wiki for any help, seems like UserInputService doesn't wouldn't return anything useful execpt the Vector2 from screen location.

Note: I tested this using the roblox studio simulation. Maybe it just doesn't work properly. or maybe i was wrong.

First question: Is it possible? If so, what could be the problem? Second: If i want to achieve this with the Vector2 supplied by TouchTap event from UserInputService, how would i do so and obtain the target part?

On the other hand, basically my goal is to make it when you press something/ touch something, it will show up a gui. But without clickdetectors as I don't want hacky ways to prevent them on PC.

Side note: It works on PC just well if you hover your mouse over the object, meaning Mouse.Target works properly on PC.

Thanks!

0
I think it won't work because there is no mouse on mobile Creeper_Dude158 11 — 6y
0
There is, It is a simulated mouse according to roblox wiki. CreeperDude. NathanAdhitya 124 — 6y

1 answer

Log in to vote
0
Answered by
ax_gold 360 Moderation Voter
6 years ago
Edited 6 years ago

Mouse.Target on Mobile is basically the last object on the screen your finger hit, excluding the move and jump buttons. However it can get annoying, because everytime you tap, there's a new mouse.Target. So I recommend using mouse.Target (and mouse.Hit) carefully on mobile so it won't get in the way if the player isn't using something that requires it.

0
I see, thanks. NathanAdhitya 124 — 6y
Ad

Answer this question