Skip to content

Commit 24bbac5

Browse files
update Open Source Docs from Roblox internal teams
1 parent c79fe4c commit 24bbac5

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

content/en-us/reference/engine/classes/UserInputService.yaml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,37 +2821,39 @@ events:
28212821
writeCapabilities: []
28222822
- name: UserInputService.TouchMoved
28232823
summary: |
2824-
Fired when a user moves their finger on a TouchEnabled device - such as
2825-
the screen of an Apple iPad or iPhone or a Google Android phone.
2824+
Fires when a user moves their finger on a `TouchEnabled` device, such as a
2825+
tablet or smartphone.
28262826
description: |
2827-
The TouchMoved event fires when a user moves their finger on a
2828-
TouchEnabled device.
2827+
Fires when a user moves their finger on a
2828+
`Class.UserInputService.TouchEnabled|TouchEnabled` device, such as a
2829+
tablet or smartphone.
28292830
2830-
This event can be used to determine when a user moves their finger while
2831-
touching the screen of a TouchEnabled device. It can be useful to track
2832-
whether a user is moving their finger on the screen, as well as where the
2833-
user is moving their finger.
2831+
This event is useful for tracking whether a user is moving their finger on
2832+
the screen, as well as where the user is moving their finger.
28342833
2835-
The code below prints "Touch moved from" the previous Vector2 position "to
2836-
" the new Vector2 position of the user's touch on a TouchEnabled device.
2834+
The code below shows the touch moving from its previous position to a new
2835+
position on a `Class.UserInputService.TouchEnabled|TouchEnabled` device.
2836+
Note that the `Class.InputObject.Position` on the passed `touch` parameter
2837+
is a `Datatype.Vector3`, but only includes X and Y coordinates; Z is
2838+
always 0.
28372839
28382840
```lua
28392841
local UserInputService = game:GetService("UserInputService")
28402842
28412843
function onTouchMoved(touch, gameProcessedEvent)
28422844
local oldPosition = touch.Position - touch.Delta
2843-
print("Touch moved from " .. tostring(oldPosition) .. "to " .. tostring(touch.Position))
2845+
print("Touch moved from " .. tostring(oldPosition) .. " to " .. tostring(touch.Position))
28442846
end
28452847
28462848
UserInputService.TouchMoved:Connect(onTouchMoved)
28472849
```
28482850
2849-
It can be paired with `Class.UserInputService.TouchStarted` and
2851+
Pair this event with `Class.UserInputService.TouchStarted` and
28502852
`Class.UserInputService.TouchEnded` to determine when a user starts
28512853
touching the screen, how their finger moves while touching it, and when
28522854
the they stop touching the screen.
28532855
2854-
To check if a user's device is TouchEnabled, and that touch events will
2856+
To check if a user's device supports touch and that touch events will
28552857
fire, see `Class.UserInputService.TouchEnabled`.
28562858
28572859
This event only fires when the Roblox client window is in focus. For

0 commit comments

Comments
 (0)