I need help with a project (Urgent)

I am new to blueprint scripting and programming in general. I am making a simple game just to test the engine out. I have created 2 buttons and have two print strings with the text “Hello World!” and “Bye Bye World”. I want to use the buttons such that if I press button 1 first, Hello World will be printed and if I press button 2, Bye Bye World will be printed. On the contrary, I also want it to work like even if I press the second button, Hello World is shown and if I press button 1 after button 2 then Bye Bye World shows up. Can anyone help me with this? I can’t wrap my brain around how to pull it off.

It sounds like no matter what buttons you press, the first one pressed will print Hello World, and the second Bye Bye World. You just can add a check if button was pressed so it wont be the same button pressed twice, and thats it.

Is it possible for you to tell me exactly what to do? I am still not getting what to do.

Something like this:

The simplest way to do what you are asking is to use a FlipFlop node and a couple of DoOnce nodes. You connect both keypress events a DoOnce node and, from it, to the execution input of the FlipFlop node. The A output of the FlipFlop is going to print Hello World. The B output is going to print Bye Bye World.

The Reset input of each DoOnce is driven by the output of the other DoOnce node, so once they fire they reset the other node so you cannot use the same key two times in a row to drive the FlipFlop.

Each time you press one of the two keys, it will switch to printing the other string. In this way, no matter which key you start with, it will always print the first and then the second. And you will always have to alternate between the two keys.

Hope it makes sense.

Hm, that is strange. Check if your bool variables are set to false by default.

Also vr marco have more optimized solution, you could try that.

I tried it, It didn’t work for me :frowning: