How to load players like the game "Every Roblox Player"

Hello everyone, I wanted to make a system just like how the roblox game ever roblox player dose. Dose anyone have an Idea on how I can script something that loads a random player form roblox

1 Like

First: #help-and-feedback:scripting-support

Second: Either a really advanced API, or (on the inefficient end) cycling through every known value (1- amount of Roblox players) and for each one loading in their characters until that value returns nil.

THEN after that, you’d need a way to stop the lag and procedurally load all of them in. I’m wayyy to bad of a coder to do that, so… I’ll leave it to the Forum coding gods.

1 Like

So I did some research, and this might work (It’ll probably be laggy with billions of HTML calls or whatever thair called)
Get ready for studio to crash!!
Your’e going to want to use players:CreateHumanoidModelFromUserId(userId)

local players = game:GetService("Players")

local maxbad = 100

local bad = 0

for i = 1, math.huge do
	local their_character = players:CreateHumanoidModelFromUserId(i) -- get their character

	if not their_character then 
		bad += 1 
		continue 
	end

	loadcharacter(their_character) -- whatever you're gonna do with this player

	if bad >= maxbad then
		break
	end
end

Hope this helps!

Edit: Didn’t fully read your post
This would be more like it

local players = game:GetService("Players")

local character = players:CreateHumanoidModelFromUserId(math.random(100, 1000000000))
character.Parent = workspace
1 Like

I want it so instead of it just being math.random it somehow uses robloxs api to do it tracking all the players just like how that one roblox game dose it

1 Like

Roblox API is what you’re looking for.

1 Like

What exactly are you trying to accomplish?
I got this:

1 Like

Yes i tried to use that but it denied my access

1 Like

I’m trying to load a bunch of players avatars randomly kinda how that game works

1 Like

So you want to load every single roblox account character into one game?

1 Like

yes basically ill handle all the loading to make sure the game doesn’t crash im just trying to load all the players in real time not using math.random for ids

1 Like

Somehow use a for loop:

local players = game:GetService("Players")

local maxbad = 100

local bad = 0

local function getcharacterofplayer(id)
	local character = players:CreateHumanoidModelFromUserId(id)
	character.Parent = workspace

	local success, name = pcall(function()
		return players:GetNameFromUserIdAsync(id)
	end)

	if success then
		character.Name = name
	end

	return success, character
end

for i = 1, math.huge do
	local succes, their_character = getcharacterofplayer(i)
	
	if not succes then 
		bad += 1 
		continue 
	else
		bad = 0
	end
	
	loadplayer(their_character) -- whatever you're gonna do with this player
	
	if bad >= maxbad then
		break
	end
end

2 Likes

Please describe what you want in terms of things instead of games :sweat_smile:

You can get a random player using their UserId. UserIds are assigned in order, so the first user ever is 1, and the next is 2, etc.

You can then load the avatar using GetHumanoidDescriptionFromUserId, and get information about the player using other functions.

You can get the most recent UserId by using a binary search algorithm on functions that use the UserId, which should give errors when the inputted UserId is too high.

Check out Players for most of the stuff you can get using a UserId.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.