UserInputService.TouchMoved - example code bug

The example code in the following API documentation is wrong:

local userInputService = game:GetService("UserInputService")
     
function(touch, gameProcessedEvent)
    local oldPosition = touch.Position - touch.Delta
    print("Touch moved from "..tostring(oldPosition).."to "..tostring(touch.Position))
end
     
userInputService.TouchMoved:Connect(TouchMoved)

The name for the function is missing on line 3.

2 Likes

~~https://devforum.roblox.com/t/typos-minor-edits-mega-thread/373882~~

Nah, I believe this thread is fine. The function header is missing the name definition, which causes the code to error.

image
The Mega-thread also mentions this type of scenario, where the code contains errors.

1 Like