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

Hey guys! I was wondering: How can I do a "press any button to continue" event?

Asked by 6 years ago

I'm building a game, and I really don't feel like typing out 40+ different things so that I can do this event, is there a short cut? And if so please link/describe said shortcut :) Thanks! -deputychicken

1 answer

Log in to vote
1
Answered by
Bellyrium 310 Moderation Voter
6 years ago

knowing that this is how you use InputService.

function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.R then
        print("R was pressed")
    end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)

then we can assume by taking out the IF gate, it will fire every time!

function onKeyPress(inputObject, gameProcessedEvent)
    print(inputObject)
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress)
0
You might want to add a logic gate to control if its just the mouse being moved or clicked though. I have no idea if the mouse is still technically a user input. I just use the local mouse Bellyrium 310 — 6y
1
I appreciate it so much! Thanks bro. :) deputychicken 226 — 6y
Ad

Answer this question