UIS InputBegan not working correctly

Hey! I’m trying to make a main menu screen, with a “press any key” intro. For that, I’m obviously using UserInputService InputBegan function.

However, it doesn’t work correctly. Clicking my mouse around or pressing any normal keys that don’t open special windows (basically all letter and number keys, not things like F9), doesn’t do anything, doesn’t register it. It’s sort of as if the game was like unfocused or something.

Not really sure how to fix this… thanks for any help.

LocalScript

UserInputService.InputBegan:Connect(function(input, gameProcessed)
	if anyKeyPressDebounce == false and gameProcessed then
		anyKeyPressDebounce = true
		PressText.UIStroke.Enabled = false
		for i = 1,25 do
			task.wait()
			PressText.TextTransparency = ((0+(0.1*i)))
		end
		for i = 1,25 do
			task.wait()
			ParadoxLogo.ImageTransparency = ((0+(0.1*i)))
		end
		MiddleLine:TweenSizeAndPosition(UDim2.new(0,0,0.003,0),UDim2.new(0.5,0,0.776,0),Enum.EasingDirection.Out,Enum.EasingStyle.Sine,0.5,true)
		task.wait(0.5)
		MiddleLine.Visible = false
	end
end)

that’s because you are only running the code when there is a game processed event.

you want to run the code when there is no game processed event.

add one word to the script:

not gameProcessed
1 Like

Ahh, yeah. Kinda got lost there, didn’t know how exactly I was meant to implement the gameProcessed value :smiley: . Thank you.

1 Like

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