Keybinds broken (SOLVED)

I wanna make a I/E to open inventory but using free models, my own programming, youtube videos
DOESNT WORK??

current code:

local userInputService = game:GetService("UserInputService")

userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	
	if input.UserInputType == Enum.UserInputType then
		
		if input.KeyCode == Enum.KeyCode.I then
			game.StarterGui.Craft.Enabled = true
			if 			game.StarterGui.Craft.Enabled == true then
				game.StarterGui.Craft.Enabled = false
			end
			print(game.Players.LocalPlayer.Name..' has pressed U.')
			
		end
		
	end
	
end)

this is so weird

FIX:
Solution script ended up needing to be in startplayerscripts

You’re never specifying a UserInputType to compare.

3 Likes

can u fix it for me im confused on how to do that

Enum.UserInputType.Keyboard if its on pc

local userInputService = game:GetService("UserInputService")

userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if input.KeyCode == Enum.KeyCode.I then
		game.StarterGui.Craft.Enabled = true
		if game.StarterGui.Craft.Enabled == true then
			game.StarterGui.Craft.Enabled = false
		end
		print(game.Players.LocalPlayer.Name..' has pressed U.')		
	end	
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.