Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Whats is the UIS difference between Touch and Click?

Asked by 3 years ago

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)

1 answer

Log in to vote
0
Answered by 3 years ago

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 :-)

0
Unfortunately it didn't changed anything. Touch and MouseButton has different properties i guess. I changed it completely :/ GeldiBaskan 13 — 3y
Ad

Answer this question