Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to add to a leaderstat once and never again?

Asked by
trecept 367 Moderation Voter
6 years ago

I'm bad with datastores and don't know how I'd go about going this. I'm trying to make an obby, and currently it checks if the player's stage is the same as the name of the part touching, and will change to +1, so if you hit it again it wont work. I want to make it so it'll add one as soon as a player touches it, but never add 1 again, whatever the player's stage is. What would I want to learn to do this?

0
peasfactory has made a tutorial about datastores if you want to learn about it. https://www.youtube.com/watch?v=VXcbZ2kurvk LordOfWatermelons 27 — 6y

1 answer

Log in to vote
0
Answered by
Nonaz_jr 439 Moderation Voter
6 years ago
Edited 6 years ago

So im not sure if I understand this right, but you check if the stage is the same as the name of the part, and then you change the players stage to +1.. so then they are not the same any more?

So why would it happen again? Can you show some code if you didn't solve it yet?

Or do you mean you want to save the leaderstat in datastores but don't know how?

Edit, oh I see, other code will change the stage and you might have the same again, but you still dont want to add +1.

Then add the name of this item (must be unique) to an array, save this array for that player in datastores, and check against this array before giving +1.

Ad

Answer this question