How to bind print string score to widget?

So i searched online and found tutorials of how to bind print score to widget, but the examples they give are totally different than my project and its hard understanding. I’m asking how would i go about successfully binding my print string score to widget so the widget will show the score. The first image is my spanner that spawns the enemies randomly right when the game starts. As you can see the node SpawnActor Thing(Enemy) and spawner reference is connected to get reference to self. The second image is my enemy BP and shows the score system. So how would i bind this to widget text? much help appreciated.

In what form is your widget? Where do you create the widget? What is it that they do in the tutorial that you cannot do? You could use your widget reference to set a variable within your widget, cast from your widget, or many other things.

like this image. In most of the tutorials they bind the widget score through Playercontoller or Playerstate BP and use get player controller when binding with the widget to show the score and i’m not using any of them. i just have a spawner and enemy BP. And i’m having trouble with doing this.

Do you need Score Variable to be in ‘Spawner Reference’ blueprint?

Why not set the Variable in the Playerstate or Player controller and when it changes add to it. Get your Playerstate/controller and increment just like you have done for the ‘Thing’ BP. Then make a variable in your widget for your Playerstate/Controller and then in your designer on the left hand side where it says Content > Text click on Bind then go down to your widget variable whether this is your Playerstate or controller and select Score Variable.

This would be the way I’d do it. What I’ve mentioned above i’m not sure is 100% step by step you may have to fill in the gaps. Not on development machine to confirm. But that’s the logic.

Edit: Thinking again where ever you store the variable you may want to convert it to a string in your HUDBP and have the HUDBP as the Widgetvariable.

Ok, when and where are you spawning your widget?

Ya i’m not the best in Bp and that’s why im having trouble with this. Could you provide example BP or something?? Cause i don’t know if this method will work entirley since you dont think it’s 100% too. Thanks for the help!

The widget is placed in the world level and shows up at all times right when the game starts. Is this important?

Go into your widget, and create a variable ‘Spawner Reference’, the type will be the spawner blueprint. Make the variable editable and expose it on spawn in the details panel. Now go to wherever you have the ‘Create Widget’ node for your widget, and you’ll need to link up the Spawner Reference input to a reference to your spawner. Now in your widget, you can access the score variable using the spawner reference. If you have trouble, I need to know where your create widget node is to be able to help you.

Ya i’m having trouble. What do you mean by i need to know where you create widget node to be able to help you?

You need a reference to your spawner for this to work. Where at in your blueprints do you add the widget to the screen?

oh sorry. I put it in the level BP, but i don’t know if i should put it there.

It really doesn’t matter where it is, as long as you have a spawner reference to hook up to the create widget, which it looks like you won’t in your level blueprint, unless the spawner is already in the world.

So how do I creat the widget working. I gave you where my widget is

So how do I creat the widget working. I gave you where my widget is

Well it depends. Is your spawner blueprint already placed in the world, or do you spawn it in once the game has started?

I explained this in my post. Read it. Basically I have the Spawner placed in the world just one. However that single spawner spawns multiple enemies randomly right when you hit the play button through the enemy BP in my 2nd uploaded image. That’s where the scoring is. Every time you kill a enemy it add one point to the score as you can see.

My bad. Keep the create widget in your level blueprint. Click on your spawner in the level, and then go into the level blueprint and right click, and then place a reference to the spawner, and then connect that to the widget spawner input. You can now use data from your spawner in the widget, so just bind the variables.

I’m sorry but how do you bind the variables. Thatsbsomething in don’t get since I don’t use widgets at all

There is no way to “bind variables” per se, but you can bind the text in the widget to a variable.Go into your widget and click on your text object, and in the details panel find the text value, and to the right of it you should see a bind option. Click on bind and then click “Create Binding”. It should now create a function. In the function you’ll want to connect the score from your spawner reference to the text return value on the function. You have now bound the score to the text widget.

Ok thanks i got it to work!