MasterOX 水
MasterOX 水5mo ago

keep track of score

how do i keep track of each player's score on a leaderboard?
19 Replies
kapa.ai
kapa.ai5mo ago
Hi @MasterOX 水. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To keep track of each player's score in NormalVR, you can use the RealtimeDictionary collection. This collection works similarly to a Dictionary<uint, ModelType>. It is commonly used to represent a model that can have fields that are dynamically added or removed at runtime. For example, if you need to store the score for N players, you could create a ScoreModel and store instances of it in a RealtimeDictionary using each player's clientID as the key. This way, you can easily manage and update the scores for each player in real-time. Here is the relevant documentation for more details: RealtimeDictionary (https://normcore.io/documentation/room/collections#non-transactional-collections) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below
MasterOX 水
MasterOX 水5mo ago
and do i sync the dictionary like any other variable? oh thank you
Mechabit
Mechabit5mo ago
a dictionary is a collection of models but one thing to keep in mind is that you don't get update events for changes to the contents of the collection an easy way around that is to add an int property next to the collection which you increment when you change the score of a player if you need updates
MasterOX 水
MasterOX 水5mo ago
ty also pretty unrelated but
MasterOX 水
MasterOX 水5mo ago
why do i get this every now and then?
No description
Mechabit
Mechabit5mo ago
you called is unowned self before the model is ready
MasterOX 水
MasterOX 水5mo ago
havent used that method tho i probably requested client id tho
Mechabit
Mechabit5mo ago
instantiated prefabs are ready at start, scene views are ready when on model replaced is called or allComponentModelsReplaced event is called
MasterOX 水
MasterOX 水5mo ago
is it because of this?
Mechabit
Mechabit5mo ago
any model related stuff you can also use model==null to test
MasterOX 水
MasterOX 水5mo ago
i mean
MasterOX 水
MasterOX 水5mo ago
thats the only thing that could cause it
No description
MasterOX 水
MasterOX 水5mo ago
and it does have model == null