Hey. I have the test code below. It’s working totally fine when i touched down and swipe my finger on screen. It’s printing location. But with the mouse it’s not working. What am i missing in here? Of course i can do this with different methods but i would like to learn the logic.
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent) if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then input:GetPropertyChangedSignal("Position"):Connect(function() print(input.Position) end) end end)
I believe that the issue is a common mistake when defining the if statement, you need parentheses:
... if (input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton) then ...
Hope this works :-)