Getting Previous Input?

I’m making a basic game to hone some of my physics and general gameplay programming skills.

I am in the process of making a model have code so when you press E, a different GUI with extra options pop up, in order to make the general UI feel less cluttered.

However, in the InputBegan event I have linking to it, while waiting for a second input to happen nearby, I have a line that goes like this:

UserInputService.InputBegan:Wait()

Now, the problem here is that I need to get this extra input data. And while I could make a second connect event relating to input, it would cause my code to be stretched out due to the script getting confused between the two UIs.

I was wondering if there was any way to retrieve an input from :Wait(), essentially.

Thanks!

I’m not quite sure what you’re trying to avoid, but you can simply use a second event and Disconnect it inside the event function and continue from there.

Here’s all the information you need for Handling Events.

1 Like

There’s no way to get data from :Wait(). There’s also no way to cancel it. It’s a big limitation with Roblox’s TaskScheduler imo. The best thing for you to do is just replace your :Wait() statement with a new connection.

1 Like