-- Updating the leaderboard

while wait(1) do
	-- Deletes everything until we make a frame
	for _, plrFrame in pairs(playerListFrame.PlayerHolder:GetChildren()) do
		if plrFrame:IsA("Frame") then
			plrFrame:Destroy()
		end
	end
	
	-- Making a frame for the player
	for i, plr in pairs(game.Players:GetPlayers()) do
		local template = script:WaitForChild("Template"):Clone()
		template.Name = plr.Name
		template.PlayerPicture.Image = game.Players:GetUserThumbnailAsync(plr.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
		template.PlayerPicture.PlayerName.Text = plr.Name
		template.Parent = playerListFrame.PlayerHolder
		template.Position = UDim2.new(0.5,0,0.5,0)
	end
	
	if #game.Players:GetPlayers() >= 7 then
		playerListFrame.PlayerHolder.CanvasSize = UDim2.new(0,0,1.05 + ((#game.Players:GetPlayers()-7) * .15),0)
	else
		playerListFrame.PlayerHolder.CanvasSize = UDim2.new(0,0,0,0)
	end
end
