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

Make mouse.hit.p and UserInputType.Touch only work when not on guis?

I'm making my building game have mobile functions but whenever I click a gui or mobile button it acts as a UserInputType.Touch and mouse.hit.p. How do I fix this?

1 comment

0

If you need a video for explanation I can do that

1 answer

✓ Accepted answer

InputBegan and other input events pass second parameter which is called "gameProcessedEvent", this is a boolean that is true if you pressed a button or are typing and false if not, you can only execute the code if it's false:

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if gameProcessedEvent then
		return
	end

	print("Not typing")
end)

1 comment

0

tytytytytyty this has saved me

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