Hello. Im making a script that displays every players character in the game on a image but for some reason the code breakes when two players load in.
It is in a server script Serverscript location is ServerScriptService
Here is my script:
local template = game.Workspace.StartRoom.Build.Elevator.BillGui:WaitForChild("BillboardGui").Players.Template
local sound = game.Workspace.StartRoom.Build.Elevator:WaitForChild("PlayerEnter")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
sound:Play()
local userId = player.UserId
local thumType = Enum.ThumbnailType.AvatarBust
local thumSize = Enum.ThumbnailSize.Size420x420
local content = game.Players:GetUserThumbnailAsync(userId, thumType, thumSize)
local clone = template:Clone()
clone.Visible = true
clone.Image = content
clone.Name = player.Name
clone.Parent = game.Workspace.StartRoom.Build.Elevator.BillGui:WaitForChild("BillboardGui").Players
end)
end)