UIS [UserInputService] Help

Hello people of the Developer Forum
I’m trying making a bomb but I’m having a smol problem:

local UIS  = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.Keyboard then
		if input.Keycode == Enum.KeyCode.F then
			local Bomb = game:WaitForChild("ReplicatedStorage").Bomb
			  Bomb:Clone()
			print("Cloned!")
		end
	end
end)

and I get this error:

image

Can someone help me, I’m just learning UIS today

Alright so the problem is you just need input.KeyCode

1 Like
local UIS  = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
		if input.Keycode == Enum.KeyCode.F then
			local Bomb = game:WaitForChild("ReplicatedStorage").Bomb
			  Bomb:Clone()
			print("Cloned!")
		end
	end
end)
2 Likes

You dont need to add the keyboard, it detects the key with just input.KeyCode for any button on the keyboard

Bruh, I just saw it XD
Thanks anyways

xD thats fine alright make sure to mark a solution so people who are also learning can get help quick!