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

UserInputService For key pressed?

Since Keyboard Input is deprecated, how would you use UserInputService to see if someone has pressed /?

1 comment

0

I know how to so it, but im not on laptop right now, if this is still unanswered when I am, I will answer you

1 answer

✓ Accepted answer

You can use InputBegan event.

game:GetService("UserInputService").InputBegan:connect(function(input,proc)
	if not proc and input.KeyCode == Enum.KeyCode.Slash then
		--code
	end
end)

'proc' is a variable that prevents input from getting accessed while typing in chat and similar.

For more information, check out these:

http://wiki.roblox.com/index.php?title=API:Class/UserInputService http://wiki.roblox.com/index.php?title=API:Class/InputObject http://wiki.roblox.com/index.php?title=API:Enum/KeyCode

2 comments

0

If chat is disabled is proc still needed?, and would this work in a local? 

0

Yes, it does work in Local. Not sure for the proc, but you should keep it.

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