Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Negative user ID????

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:

  1. User ID: -657732837

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

1 comment

5

Negative UserId's are Guests!

1 answer

✓ Accepted answer

Negative UserID's belong to Guests.

This discussion is preserved as it was. New answers, comments, and votes are closed.