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?
✓ ANSWER ACCEPTED
Make mouse.hit.p and UserInputType.Touch only work when not on guis?
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.

1 comment
If you need a video for explanation I can do that