Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Whats is the UIS difference between Touch and Click?

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

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

1 comment

0

Unfortunately it didn't changed anything. Touch and MouseButton has different properties i guess. I changed it completely :/

This discussion is preserved as it was. New answers, comments, and votes are closed.