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

How would I make UserInputService stop checking for "e" press?

Asked by 6 years ago
Edited 6 years ago

I'm making a press e to pick up and put down, but I also have a press e to put the item onto, lets say a table. When I'm near this table, it starts checking for "e" press to put it on the table, however, if I were to walk away it would still check for "e". So, is there a way to make UserInputService stop checking for "e"? It pretty much merges with the pick up and down press "e" script such that when I press "e" both scripts activate.

1 answer

Log in to vote
0
Answered by
H4X0MSYT 536 Moderation Voter
6 years ago
Edited 6 years ago

I don't know of a method to do this, BUT you can simply have a variable to hold if the player is holding an item or not, and when the e key is pressed, check that variable before doing anything.

EDIT:

local holding_item = false
 --Trigger
    if holding_item ~= true then
        holding_item = true
        -- Is not holding an item
    else
        holding_item = false -- if drops on the spot
        -- is holding an item
    end
end
0
Could you give me an example, I'm currently very confused with what I should do. AbandonedRick 112 — 6y
Ad

Answer this question