Player typing overrides tool equip

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make it so that the typing in the chat doesn’t override the when equipping tools
  2. What is the issue? Include screenshots / videos if possible!
    Whenever a player types “e”, it triggers the UserInputService and equips the tool.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried looking for the solutions on Google but I haven’t found any that solved my so problem so far.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Userinputservice.InputBegan:Connect(function(key, istyping)
	if istyping then
		return -- return if user is typing
	else
		if key.KeyCode == Enum.KeyCode.E then
			-- Do stuff
		end
	end
end)

Could this be your solution?

Would like to clarify that istyping doesn’t just refer to if the player is typing or not.
The correct term would be gameProcessedEvent. According to the wiki:

Indicates whether the game engine internally observed this input and acted on it. Generally this refers to UI processing, so if a button was touched or clicked from this input, gameProcessedEvent would be true . This is also true for input events connected via ContextActionService

This becomes true if a player is focused on a TextBox (aka chat) or has clicked, for example, a TextButton.

Its the same thing lol using it as a reference for 2nd arg

Yeah, I understand that. Just wanted to clarify that the second parameter doesn’t just apply if the player is typing or not.

Then whats your solution, hes using userinputservice after all.

Thank you so much, it worked!!

Ah I see! Thank you for the clarification!

I’m not saying your solution is incorrect. It’s 100% correct, I’m merely clarifying that the second parameter doesn’t just apply to typing.

Understandable, But i never said it only applied to typing.

Oh Im Sorry, i misread your post sorry for the inconvenience.

2 Likes