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

Why when I type, an animation would play on my character?

It's basically a Basketball that when you press the key "E", it's supposed to shoot the ball (which works) , it's just it does it no matter what situation you're in, as in like if you type, it'll do shoot the ball, here's the script I just need it to be only from when you're not typing.

uis.InputBegan:connect(function(input,gameProcessedEvent)
		if input.KeyCode == Enum.KeyCode.E or input.KeyCode == Enum.KeyCode.ButtonX then

Basically, I want this to run this when you're not typing, and I really don't know how to check if the player is typing, all I know is that it belongs somewhere in the if statement.

1 answer

That's what the gameProcessedEvent argument is for. It is true if the user is typing in a textbox or such. You need to exit your function when that argument is true, like so:

uis.InputBegan:Connect(function(input,gameProcessedEvent)
	if gameProcessedEvent then
		return
	end
	--rest of the code
end)

(also make sure to use :Connect(), not :connect() ;) )

1 comment

0

ill try this, thanks!

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