Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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

Log in to vote
1
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

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() ;) )

0
ill try this, thanks! Resplendid 3 — 5y
Ad

Answer this question