Why is this pressing "F" not opening this gui?

Hello there,
So basically, I’m trying to work on a script which when a player pressed “F” or Left on the DPAD it opens a gui. Here’s my script, nothing is being printed and the frame isn’t tweeting as well as there are no errors.

wait(3)
local Players = game:GetService("Players")
local playerUI = Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("UI")
local userInputService = game:GetService("UserInputService")
local buildOpen = false

userInputService.InputBegan:connect(function(inputObject, gameprocess)
	if not gameprocess and inputObject == Enum.KeyCode.F or inputObject == Enum.KeyCode.DPadLeft then
		print("opening")
        playerUI:FindFirstChild("buildFrame"):TweenPosition(UDim2.new(0.5, 0, 0.5, 0),"In", "Bounce", 1)
    end
end)

Thank you for your help if you are able to help me in any way! If not, have a great rest of your day.

Thank you for reminding me, this is placed in StarterPlayerScripts. It is also a LocalScript

You meant to compare the input object’s KeyCode.

if inputObject.KeyCode == Enum.KeyCode.F or inputObject.KeyCode == Enum.KeyCode.DPadLeft then 
   --
end
1 Like

inputObject is an InputObject, so you need to use
and inputObject.KeyCode == Enum.KeyCode.F ...

2 Likes

I’m coming to a conclusion that all of my mistakes are the simple ones. Thank you for your help.