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

Negative user ID????

Asked by
funyun 958 Moderation Voter
9 years ago

I have a script that saves the user IDs of people that join my game. Here it is:

datastore = game:GetService("DataStoreService"):GetOrderedDataStore("Visitors")
http = game:GetService("HttpService")


function onPlayerAdded(player)
    datastore:SetAsync(player.userId, 0)

    local pages = datastore:GetSortedAsync(false, 10)
    local pagenumber = 1

    while wait() do
        print("Page "..pagenumber)
        local page = pages:GetCurrentPage()

        for i, v in pairs(page) do
            print(i..") User ID: "..v.key)
        end

        if pages.IsFinished then break end
        pages:AdvanceToNextPageAsync()
        pagenumber = pagenumber + 1
    end
end


game.Players.PlayerAdded:connect(onPlayerAdded)

And then I noticed something freaky. I saw this in the output:

9) User ID: -657732837

..That's a negative user ID. How does that even happen? I don't get it.

5
Negative UserId's are Guests! TheDarkOrganism 173 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

Negative UserID's belong to Guests.

Ad

Answer this question