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

Request Rejected Datastore?

Asked by 10 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!

    local hasJoined = ds:GetAsync(newplayer.Name.."_JOIN")
    if hasJoined == nil then
        isprevioususer = 0
        ds:SetAsync(newplayer.Name.."_JOIN", 1)
    elseif hasJoined >= 1 then
        isprevioususer = hasJoined
        ds:IncrementAsync(newplayer.Name.."_JOIN", 1)
    end

1 answer

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

I heard of this problem somewhere. Replace line 2 with

if not hasJoined then

If that doesn't work then try

if 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 — 10y
0
Server test in in studio. Add prints to the script to see what the value is then press F7 in studio. Bebee2 195 — 10y
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 — 10y
0
What's the error? Bebee2 195 — 10y
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 — 10y
0
Try putting this in the output before you start the server. game:SetPlaceId(idofplace,false) Bebee2 195 — 10y
0
Okay. thecanadiangamesnerd 20 — 10y
0
Same thing. thecanadiangamesnerd 20 — 10y
Ad

Answer this question