Hello!
How to fix that? In my opinion that should work but doesnt work
The Players on client should show value “1”.
Please help me
Hello!
How to fix that? In my opinion that should work but doesnt work
The Players on client should show value “1”.
Please help me
It doesn’t work because you didn’t set the TextRed variable in the UpdateGameStart (Event is faster than replication of the variable)
Set the variable first (TextRed) before calling Set Text
The problem is in the UpdateGameStart, you should get the text widget not set it, get the text widget component (make it variable first) and call SetText function
just do it again trust me it will work
Thank you again for answer but again it still doesn’t work. Please please god why its doesn’t work My next update according to your post:
Don’t make the variable replicated if you’re going to update it with an event, also print a string after the setText to see if it’s called at all.
Where are you storing the TextRed variable ? you should put it in the Game State and make it rep notify. You should not store it in the character class or player controller because there are many copies depending on how many players. So you’ll need to store that variable in the Game state. Can you do that ? I’ll show you what to do next.
Ok then that’s the issue, right lick somewhere and click on add a blueprint class, show all classes and look for game state base and create one
In your world settings (image you showed me) select the game state you just created. Next open the game state and create a variable let’s call it TeamRed, make it rep notify so that when it changes all clients will be notified. After you make it rep notify you’ll notice a new function will be added.
Double click on the OnRep_TeamRed function and let’s update the clients when it changes by the server.
Make UpdateGameStart not replicated
Now in your player controller when you call JoinTeam you’re gonna do this instead
(Change the cast name to the name you selected for your game state)
So basically when the server changes the TeamRed in the game state, it will be automatically updated on all clients thanks to the Rep_Notify function which calls the player controller and tell it to UpdateGameStart in this event update your widget with value sent.
Check if Valid ? or do IsLocallyController like I’ve shown you.
Replicated characters can’t have widgets that’s why it’s null. You need to check if LocallyController (which means is it an actual player ? not a replicated version of it) or IsValid.
I can’t find Game State in files. I thnik i can’t do that.
Yes it can be that problem because Math variable (TextRed) is in GameplayPC (player controller).
Here you go:
Oh my god i see that it should work!!! thank you!!! but now it looking like client widget is death.
I have connected that system of showing widget with my another system in GameplayPC, that working before. What i should do now?
If i change Game State to old, that’s working like before:
I think that we should it first fix widget which is not showing in client because it is the problem with error i think.
Don’t do it there, RunOnOwningClient already make sure it’s a locally controller, do it where you get the error.
Oh if it’s not showing then that’s the issue, how come it stopped showing ? Add the widget in the begin player of your player controller and only do it if LocallyController.