APlayerState::GetScore
#include "GameFramework/PlayerState.h"
Access: public
Specifiers: UFUNCTIONBlueprintGetter
Description
Returns the player's current replicated score value.
Caveats & Gotchas
- • Score is replicated to all clients via OnRep_Score — reads on clients reflect the last received network value, which may lag slightly behind the server.
- • This is the raw float value; any display formatting (rounding, currency symbols) must be done by the caller.
Signature
float GetScore() const Return Type
float Example
Display score in HUD C++
if (APlayerState* PS = GetPlayerState())
{
float CurrentScore = PS->GetScore();
ScoreText->SetText(FText::AsNumber(FMath::FloorToInt(CurrentScore)));
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?