when passed an input object from the InputBegan
event of a UI object, the input object’s position and delta will only update if the InputType of the InputObject is touch.
repro:
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
local screenGui = Instance.new("ScreenGui", playerGui)
local textButton = Instance.new("TextButton", screenGui)
local MOUSE_1 = Enum.UserInputType.MouseButton1
local TOUCH = Enum.UserInputType.Touch
textButton.InputBegan:Connect(function(inputObject)
local inputType = inputObject.UserInputType
if inputType == MOUSE_1 or inputType == TOUCH then
inputObject:GetPropertyChangedSignal("Position"):Connect(function()
print(inputType, inputObject.Position)
end)
end
end)
when using a mouse, the position will only update on mouse down and mouse up. when using touch, the position will update any time the touch position is changed.