Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I get a Position on the map with Mobile Devices?

I've tried touchstarted, but it returns a screen position (which makes z=0) I want it to return a vector3 from the map for wherever they touch on their screen Any idea on how to do so?

1 answer

✓ Accepted answer

Assuming where they touch it moves the 'mouse' to the coords of the touch you can get the position of where they touched with mouse.Hit

local player = game.Players.LocalPlayer
local mouse = player:GetMouse() --gets the mouse
local uis = game:GetService("UserInputService")

uis.TouchStarted:connect(function()
	if mouse.Hit then --mouse.Hit is a cframe
		print('Player touched at '..mouse.Hit.p) --.p gets the position from the CFrame
	end
end)

1 comment

0

Worked. Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.