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

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

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

✓ Accepted answer

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)

2 comments

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

1

I appreciate it so much! Thanks bro. :)

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