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

How to detect which key that player pressed and convert them into Enum.KeyCode?

I quite know How to detect specific key but However, this one Has to detect any key that player pressed and then convert it into Enum.KeyCode to use with another script.

1 answer

✓ Accepted answer

UserInputService

game:GetService("UserInputService").InputBegan:Connect(function(key, IsChatting)
	if key.KeyCode == Enum.KeyCode.R and not IsChatting then
		print("Your pressed "..key) -- Would print "You pressed R"
	end
end)

2 comments

0

Hm... This one is specific key detect, Then... If I use "print(key.KeyCode)" will given result of key that player detect. Did I'm right? However then How to convert it into Enum.KeyCode?

0

Well forget about this question anyway. Thank you very much...

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