UserInputService Not Working?

Hmmm
Can you check to make sure your output is set to show all output types
image

2 Likes

image
image
All of them are shown

Hmmm
Here’s one last test, add a print to the front of the script.
If nothing gets printed, use Ctrl + Shift + F and see if a different script is deleting or disabling your script. Are you using a framework?

You can probably search for:
.Disabled =

1 Like

I believe i already tried this, i tried it again, and it prints text only outside of the UserInputService event
but when i try to do anything inside said event it doesnt register anything being pressed

1 Like

My best guess then would be that some other script is disabling or destroying your user input script.

I did a quick test, and found that something could be printed before the script was destroyed. But when it was destroyed all connections were lost.

-- script 1
print('testy')

local uis = game:GetService("UserInputService");
uis.InputBegan:Connect(function(i)
	print(i.KeyCode);
end)
uis.InputBegan:Connect(function(i)
	print(i.KeyCode)
end)
-- script 2
script.Parent.toBeDeleted:Destroy();

image

I’d take a look into that

1 Like

Try this in local script

UIS.InputBegan:Connect(function(input, isTyping)
  if Istyping then 
return
elseif input.KeyCode == Enum.KeyCode.E then
print("E Was pressed")
      end)
end)

1 Like

i can put a print statement after the UIS event and it will print whatever i said to print, and there is no other scripts disabling or destroying the original script, i have already checked my other scripts to make sure that wasn’t the issue

No this had the same result as the other person, it didn’t work unfortunately

Wait a second do you want to send this to the serverscript? or is it just a test

1 Like

It is just a test to see why UIS isn’t working

Ok maybe try something different like part:Destroy() because i dont think print will work in this case

1 Like

Thats the issue i tried warning and tried using the actual piece of code i wanted too, it simple isn’t detecting that im pressing a input

actual piece of code, what does it look like

1 Like

@kl87hn666 try this

local UserInputService = game:GetService("UserInputService")

local Kinput = false
local Iinput = false


UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if input.UserInputType == Enum.UserInputType.Keyboard then

		if input.KeyCode == Enum.KeyCode.E then 
			Kinput = true
			
			while Kinput == true do
				wait()
				print("E Was Pressed")
			end
		end
		if input.KeyCode == Enum.KeyCode.E then 
			while Iinput == true do
				wait()
				print("E Was Pressed")
			end
		end
		
	end
	
end)
1 Like
local UIS = game:GetService("UserInputService")
local holding = true

UIS.InputBegan:Connect(function(input, isTyping)
	if input.KeyCode == Enum.KeyCode.E then
		if isTyping then return else
			if holding == true then
				local plr = game.Players.LocalPlayer
				local Remote = game.ReplicatedStorage.ESysEvent
				Remote:FireServer(plr)
			end
		end
	end
end)

try the other method i gave you

1 Like

That’s not the issue i am having the issue i am having is UIS not detecting an input, but i gave your code a test and it did not work.

hmm wheres your script located

1 Like

No… my script is in StarterCharacterScripts, i have also tried StarterPlayerScripts, and i have also tried everything that other people have suggested nothing has worked so far

have you tested the actual game, not in roblox studio?

1 Like