I’m new to replication and multiplayer so maybe im missing something simple here. I have a HUD that on startup spawns the characters UI and makes a reference to it call “Main widget ref”.
Then once selecting team and spawning FirstPersonCharacterBP in it runs a on event begin play to a RPC Server - to RPC Owning Client to give my players their team tag and attempting to give my HUD widget ref a ref to the first person character that has the health comp inside it. (as seen in photo 2)
It reads nothing from the first person var inside the HUD widget. I feel like my health comp should be on the character BP and i feel like my UI setup works best when spawned on HUD But not getting the results i need from this setup, is this structured wrong?
the server RPC can fire before the Player has loaded therefore being missed. Do you even need the server RPC? can you use BeginPlay on the LocalPlayer?
you Widget is marked as replicated but widgets are local only so they dont replicate, is it setup correctly on client? does it pass the valid check?
Dont use GetPlayerController(x) in multiplayer, its probably fine here but can break in future.
I dont see your health anywhere but things like health should be RepNotify not RPC.
Check your Tags, you Tag is replicated but the Tags array isnt, although if its the inbuild Tags im not sure how they work in multiplayer, i’d suggest creating a struct for ‘playerstate’ ie Name/Team etc and repnotify that
Health, stats, team, etc should be in the PlayerState for multiplayer.
On the characters autonomous proxy use begin play to call up to the controller. From PC you can get the player state natively. Fire off server RPCs relating to health stats from the PS.
On the receiving side have the authority proxy call the GS, GM etc as needed. Setting values happens on the authority end.
Health in the PS should be a Rep notify. This will create an onrep health function. Use that function to update UI etc.
As far as setting teams this should be handled by the GM via on post login.
On post login provides a ref to the controller. Use that red to get the PlayerState and set the team. You can use an onrep here as well. Helps if teams can be changed later. Use the onrep function to update team colors, UI etc.