Why does this keypress event not fire?

The issue seems to be with pressing W, I tried it without the isTyping portion and it still wouldn’t print W. I am confused.


local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")

local player = Players.LocalPlayer

UserInputService.InputBegan:Connect(function(input, isTyping)
	if not isTyping and input == Enum.KeyCode.W then
		ReplicatedStorage.Fly:FireServer()
	end
end)

Change input == Enum.KeyCode.W to input.KeyCode == Enum.KeyCode.W

2 Likes

the input in your code must be Input.KeyCode

2 Likes