How can I make my lobby more seamless?

Hello! I’ve been working on a cross-server matchmaking system for the past week.
And have displayed the players characters like shown below:

The way this system works is every time a player join/leaves a queue an update is fired to all players in the queue containing a list of players.

The way I display the characters is every time this update is processed, I clear all the models and spawn the list of players back in.

My issue with this is it creates a 2 second(ish) gap of no characters, as they are all loading. What’s the best way to go about only adding/removing the changes to the queue?

2 Likes

Could you show your script’s code? Is it always near 2 seconds (and do you know a reason as to why it’s near 2 seconds)?

1 Like

It’s most probably because it loads the player’s clothing items, and that “2 second” delay is much more likely the delay that it takes to download the data.

I’m wondering what would be the proper way to only add/remove players from the character preview, rather than re-drawing all of them.

1 Like

As for my code, this is what it looks like.

local function spawnModels(memberList)
	memberList = memberList or {} 
	clearModels() -- Makes all characters in the preview invisible.
	local users = {} -- List of userIDs
	for userID, serverID in next, memberList do table.insert(users,userID) end
	
	for i, model in pairs(personFolder:GetChildren()) do -- Loops through each dummy.
		if i > #users then return end
		model.Humanoid:ApplyDescription(game:GetService("Players"):GetHumanoidDescriptionFromUserId(users[i])) -- Appends the players clothing items to the dummy model (that's invisible)
		toggleVisibility(model) -- Makes the model visible.
	end
end```

Try this:

local PS = game:GetService("Players")

local function spawnModels(memberList)
	clearModels() -- Makes all characters in the preview invisible.

    memberList = memberList or {} 
    local users = {} -- List of userIDs
    for userID, v in ipairs(memberList) do
        table.insert(users,userID)
    end
	
	for i, model in ipairs(personFolder:GetChildren()) do -- Loops through each dummy.
		if i > #users then 
            return 
        end

        local hum = model.Humanoid

        if hum then
            hum:ApplyDescription(PS:GetHumanoidDescriptionFromUserId(users[i])) -- Appends the players clothing items to the dummy model (that's invisible)
            toggleVisibility(model) -- Makes the model visible.
        else
            warn("hum does not exist!")
        end
	end
end
1 Like

Nothing spawns with this code now.