I want to apply different values for each user

rr

I added 3 different accounts.

Let’s say that the three accounts are different people.

If you click the button 3 times on the first account, the point is 3.
If you click the button four times on the second account, it’s point four.
If you click the button 7 times on the third account, it’s point 7.

Like this, I want to save different variables for each other.

I made a function like this.

but, points in your account are initialized every time you run the app.

Please help me out on what to do. plzzz

1 Like

You need to use the cloud variable path to the number of points node in Firebase. When you click the button, change the firebase value.

Use cloud variables, not app variables.

1 Like

That’s how there was an error. Can you tell me through a picture?

When the button is clicked, first read the value of points in Firebase then add the new points to it and then save it back to Firebase,

It would be something like this:

thank you for your help

kk

However, if I use this block first and save it to the database and set the block you mentioned, it seems to work properly.

What should I save these points as? If you do not fill in the blanks, you cannot enter point values.

If I set a random number, it will change to a random number every time the app is run. No saving

Which block should I put in?

help me …

You should create the object with a score value of zero. But you need to create the object when the user first signs up, not when the button is clicked.

1 Like

Then, how do I set the code?

If you set it as a signs up, information is stored as the last registered account, not as a login account.

Sorry, I misspoke. When a user signs in with Firebase, Thunkable provides a green block called userId. You can check to see if User/userId exists (is not null) and if it doesn’t, then create an object. That way, the object only gets created one time, the first time the user signs in to your app.

Can you show us the picture? It’s confusing.

Even if I find it myself and make a code, an error appears. Give them a hand. ㅔplzzz

Try this. I would test it without the Navigate block. You might need a slight delay between the cloud variable block and the Navigate block so leave it out for now. If the =null condition doesn’t trigger when you first sign in, then you may have to check the properties of Users/ or whatever your top Firebase level is for the existence of [user id] but I think the =null condition will work. Make sure you are using an account that has been verified by clicking the link your receive from Firebase in your email account.

I love you. If you were next to me, I would kiss you even a million times. Thank you so much. You’re a genius.

Well… you’re welcome!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.