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

Request Rejected Datastore?

Asked by 11 years ago

Heya. I'm trying to get the game to check if the player has visited before, and if not, then set the Async to "1" and continue incrementing for that player each time he/she joins. I read up on the forum, and I unfortunately need to check the key before I set it. Thanks!

1local hasJoined = ds:GetAsync(newplayer.Name.."_JOIN")
2if hasJoined == nil then
3    isprevioususer = 0
4    ds:SetAsync(newplayer.Name.."_JOIN", 1)
5elseif hasJoined >= 1 then
6    isprevioususer = hasJoined
7    ds:IncrementAsync(newplayer.Name.."_JOIN", 1)
8end

1 answer

Log in to vote
0
Answered by
Bebee2 195
11 years ago

I heard of this problem somewhere. Replace line 2 with

1if not hasJoined then

If that doesn't work then try

1if type(hasJoined) ~= number then

I believe an empty key in a data store returns something but not nil.

0
Yes, but it throws an ERROR. It doesn't actually return anything at all, the script doesn't get that far. thecanadiangamesnerd 20 — 11y
0
Server test in in studio. Add prints to the script to see what the value is then press F7 in studio. Bebee2 195 — 11y
0
Yeah, if I put anything after the 1st line, it won't run because it's throwing an error and the script is automatically shut down. thecanadiangamesnerd 20 — 11y
0
What's the error? Bebee2 195 — 11y
View all comments (4 more)
0
I get " 20:06:44.010 - Request rejected" and "20:06:44.012 - Player1_JOIN" in the output box. thecanadiangamesnerd 20 — 11y
0
Try putting this in the output before you start the server. game:SetPlaceId(idofplace,false) Bebee2 195 — 11y
0
Okay. thecanadiangamesnerd 20 — 11y
0
Same thing. thecanadiangamesnerd 20 — 11y
Ad

Answer this question