its on my first player now i want it on my second player
Hello master041398,
We’ll need to know how you have your UMG set up to know how you would go about adding it for the second player. Could you post some screenshots of the blueprints to give us a frame of reference?
How are you spawning this widget for the first player?
Unfortunately that’s not what I need to see. I need to the blueprint script where you add the widget to the viewport. Depending on how you’re doing it, there could be multiple ways to approach this.
That’s still not it. Somewhere in your BPs you’ll create the widget and and then “Add to Viewport”.
Depending on how your splitscreen is set up, you should be able to edit the Widget BP itself to duplicate everything you’ve already done to the right side of the screen (Just copy and paste the existing widgets). You can then replace the binding for the Coins’ counter to track a variable that corresponds to how many coins the 2nd player has collected.
i understand how to duplicate it but what would i change the variable to
You would want to use a second variable for the second player. You could set it up just like you did for the first player’s coin count, but you’ll need a separate variable for the second player.
alright i have done that but i have a new issue of nothing showing up for the second player here is a screen shot
when i went into the umg to add in the second player i changed the get text so that why it would cast to the second player and now this happened
Are you sure that the Text Block or Text Box that contained your coin count got duplicated as well? If the text block/box is there, the binding may have a problem as it may not be reading the variable correctly. It should be at least showing a 0.
If it’s showing blank after setting up the binding, it could be failing the cast or not reading the character correctly. The binding should be set up something like this:
Notice the Player Index in the Get Player Character node is set to 1, which would refer to the second player character since it is a 0-based system. This is assuming that you’re actually doing multiplayer and that these characters are using separate controllers. If this is not the case, the solution will be quite different since both players are technically considered to be the same player.
yes i use two different controller for the game but after changing that it still has not changed
It disappears after i change the binding to the “GetText_1” other wise its at 9999
Can you share a screenshot of your binding’s graph?
The cast is failing in this case, as you are looking at the Player Index 0 when using the “Get Player Character” node. 0 refers to the first player. If you wish to refer to the 2nd player, you’ll need to enter “1” into that Player Index field.