Bug with UserInputService?

I want to print after I press a certain key, but UserInputService doesn’t seem to be working? I used the Devforum to figure out the proper syntax but it still seems to be bugging. Here’s the local script below, is anyone else running into this issue?

Local Script

UserInputType is used to specify customers how they input it. Use KeyCode instead.

if input.KeyCode = Enum.KeyCode.F then
1 Like

You are looking for the input type, not the input keycode. Here is a solution:

local uis = game:GetService("UserInputService")
local Trash = game.ReplicatedSotrage.IHateScripting

uis.InputBegan:Connect(function(input, gpe)
    if (input.KeyCode == Enum.KeyCode.F) then
        Trash:FireServer()
        print("I hate scripting")
    end
end

Also make sure to format your code block so we can copy and paste it, and change it easily.

Like this:

It should format like this:

-- This is a code block!
1 Like

I will start formatting the code blocks, thank you!