Roblox chat breaks inputEnded and ignores end after opening

if i have a button on inputbegan and start holding then Open chat, inputended breaks and doesnt listen

whats a way to get around this?

1 Like

am trying to make a sprint but this breaks the end function

Can you show me your script, please?

If you’re doing if gameProcessedEvent then return end, that is why. The gameProcessedEvent is a booleon, and will be true if the game itself processed the event and not the script. An example would be typing in a TextBox, which is what typing in chat is. The box you type in for chat is just a normal TextBox GuiObject, it’s just part of CoreGui.

If i use inputbegan and fire it then type in chat, inputended wont listen for the button and lasts until inputbegan fires again

i dont need help with this anymore but is there a way around this?

I need to see the script to help you.

something like this

UIS.InputBegan:Connect(function(input, gameProccessed)
	if gameProccessed then return end
	if input.KeyCode == Enum.KeyCode.F then
	print("started lll")
	end
end)

UIS.InputEnded:Connect(function(input, gameProccessed)
	if gameProccessed then return end
	if input.KeyCode == Enum.KeyCode.F then
		print("ended lll")
	end
end)

inputended stops listening after you start typing in chat

Remove that line in InputEnded. It should fix it.

I explained why in my first response.

then it fires while your typing or paused, is it good for general functions? like crouching etc

Actually, I suggest changing the line to something like this instead:

if gameProccessed and input.KeyCode ~= Enum.KeyCode.F then return end

You check if gameProcessedEvent is true and if the KeyCode is not F, so that way it won’t do anything at all for the F key, but it will for others.


If you need to do this for multiple keys, I suggest making a dictionary of “discarded KeyCodes” and checking if the KeyCode is not in that table instead of doing a bunch of and or statements.

local DiscardedKeyCodes = {
	Enum.KeyCode.F, --// Real KeyCode
	Enum.KeyCode.G, --// Example KeyCode
	Enum.KeyCode.H, --// Example KeyCode
}

UIS.InputEnded:Connect(function(input, gameProccessed)
	if gameProccessed and not table.find(DiscardedKeyCodes, input.KeyCode) then return end
	
	if input.KeyCode == Enum.KeyCode.F then
		print("ended lll")
	end
end)

I thought of and did this way too fast. I might have it backwards in my head. Please tell me if it doesn’t work lmao

I forgot to answer your question lol. Sorry.

Can you explain what you mean a little more? I’m a bit confused. Do you mean is what I suggested good or cancelling the function if the game processed the event?

im confused though, doesnt removing the gpe mean that using the intended key in a different context will trigger the function ?