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?
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.
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```
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