I've made a script that detects when a specific key is pressed. I have tried putting a print function to see if it was detected or not and it did not print the message. Could it be something to do with studio?
Script:
local uis = game:GetService("UserInputService") local plr = game.Players.LocalPlayer local chatting = false local frame = script.Parent plr.Chatted:connect(function(msg) chatting = false end) uis.InputBegan:connect(function(input) if input == Enum.KeyCode.Slash and game.StarterGui:GetCoreGuiEnabled("Chat") then chatting = true elseif input == Enum.KeyCode.Return then chatting = false end if chatting == false then if input == Enum.KeyCode.Equals then frame.Visible = not frame.Visible end end end)
I am using a localscript btw
Input.KeyCode, not Input. UserInputService.InputBegan gives you an InputObject as an argument.
You have a little mistake out there on line 11:
if input == Enum.KeyCode.Slash -- no if input.KeyCode == Enum.KeyCode.Slash -- yes
you forgot to put keycode there, now it should work..