Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

User Input ?

So basically I'm willing to make a basic key detection event.

I've been using the InputBegan event from UserInputService, yet this is the issues :

" This event will always fire regardless of game state "

The scripts detects the keys pressed even when a player is typing, which is an issue. Do you know a way to disable the event while the player is typing?

( I'm not using KeyDown event for reasons )

1 comment

0

Well, i can suggest that you could make an exception table with the keys that you don't want to be pressed. ( Like, local NotTriggered = {"a","b","c"} )

1 answer

✓ Accepted answer

Here is a fix :P

local UIS = game:GetService'UserInputService'

UIS.InputBegan:connect(function(Input,gameProcessedEvent)
	if Input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessedEvent then
		if Input.KeyCode == Enum.KeyCode.W then -- Change W  to the actual key being pressed
			-- Stuff
		end
	end
end

gameProcessedEvent checks if the game processed the event which would mean they chatted.

1 comment

0

If GPE is true, they are typing. If it's false they are not. Just clarifying :)

This discussion is preserved as it was. New answers, comments, and votes are closed.