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

How do I correctly reference a player in Data Stores with Remote Event?

Asked by 6 years ago

I understand GetAsync, SetAsync, and key but what I do not understand is firing a Remote Event from client to server adding points to a player and then saving.

Process, gui button that you click > fire Remote Event > receive $150 cash from OnServerEvent function > save data

**When I do this order, all players receive cash instead of one client. Someone had answer this, but forums are down and I lost the link. I still struggle with Data Stores, and I just only want an explanation that I understand since I'm slow. **

0
I know how to do client to server, I just don't know how to make it apply cash for one client only. This is a player reference issue liteImpulse 47 — 6y
0
make sure you are saving the player's data to a key on the datastore, ex. a player with a userid of 12345678 would get their data by doing :GetAsync(12345678) CPF2 406 — 6y
0
I'm going to look into that, perhaps I'm not seeing closely enough haha. I'll look into it anyway :) liteImpulse 47 — 6y
0
Okay I'm still stuck, it's not the key though. I just want Player1 to get 150 cash from client to server, just Player1. Not only does Player1 get 150 cash, but Player2 also gets it. How can I get Player1 to only get it, and not Player2. liteImpulse 47 — 6y

Answer this question