Here is the localscript on a ScreenGui object, wordDis is also a child of ScreenGUI. `` function displayWord(key)
if(key == Enum.KeyCode.R) then script.Parent.wordDis.Text = "yes" end if(key == Enum.KeyCode.F) then script.Parent.ScreenGUI.wordDis.Text = "yo" end end game:GetService("UserInputService").InputBegan:connect(displayWord)
key
is not actually the keycode. key
is actually an InputObject. To get the KeyCode, you must use key.KeyCode
instead.