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

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

Asked by 2 years ago

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?

0
If you need a video for explanation I can do that GameStealerKid 79 — 2y

1 answer

Log in to vote
1
Answered by
imKirda 4491 Moderation Voter Community Moderator
2 years ago

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)
0
tytytytytyty this has saved me GameStealerKid 79 — 2y
Ad

Answer this question