How to detect if something is keycode or userinputtype?

hello i need help to know if something is a keycode or a userinputtype, this is what i already make so far

--
local UserInputService = game:GetService("UserInputService")

--
local preferences = {
	keys = {
		toggle = Enum.KeyCode.F,
		begin = Enum.UserInputType.MouseButton1,
	},
}

--
if typeof(preferences.keys.toggle) == "EnumItem" then
	--[[
	will always print becaus
	both are enumitems already
	i tried using "enum" and 
	"enums" but non work
	]]
	
	print("fjbahfjbdstgs")
end

problem is that EnumItem works for both useriunputtype and keycode too so is there a way to tell the differents or do i have to check userinputstate type first for all of them and check if it is a Userinputtype.Keyboard?

EnumItems have an EnumType property.

So something like

print(Enum.KeyCode.F.EnumType == Enum.KeyCode)

writes true to the console, if that is what you were looking for.

8 Likes

yes thank u i didn ot know that was a thing