There is not Enum.KeyCode.Enter?

Hello!
I just wanted do when play press enter the command in MY TERMINAL will be exucuted BUT
There is problem I need do Enum.KeyCode.Enter but that is not exist there is only Enum.KeyCode.KeyPadEnter
Here is my code

local Checkcmd = game.ReplicatedStorage.IsCmdValid
local CodeInput = script.Parent.CodeInput
local UserInputService = game:GetService("UserInputService")
local WritingBoolean = script.Parent.Writing
local Line = 1
UserInputService.InputBegan:Connect(function(key, IsTyping)
	if key.KeyCode == Enum.KeyCode.KeypadEnter and IsTyping == false then -- THIS LINE!
		if WritingBoolean.Value == true then
			if CodeInput.Text ~= "" then
				local IsItValid = Checkcmd:InvokeServer(CodeInput.Text)
				if IsItValid == nil then
					script.Parent.Holder[Line].Text = "Incorrect Command! Please say help to view commands!"
					Line = Line + 1
				else
					script.Parent.Holder[Line].Text = IsItValid.ReturnMessage
					Line = Line + 1
				end
			end
		end
	end
end)
game:GetService("RunService").Stepped:Connect(function()
	if Line >= 40 then
		for _,k in pairs(script.Parent.Holder:GetChildren()) do
			if k:IsA("TextLabel") then
				k.Text = ""
			end
		end
		Line = 1
	end
end)

Thanks!

1 Like

Try Enum.KeyCode.Return, (carriage return).

27 Likes

Why can’t u use the Enter pressed argument of TextBox.FocusLost?

4 Likes